You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-06-20] Stop highlighting report mentions in non policy rooms in the Composer #41597
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ImprovementItem broken or needs improvement.
Problem:
While typing a report mention in the composer in a DM or group chat the mention is highlighted, even though it is not possible to mention a report in this types o chats.
Solution:
We need to stop applying the markdown style to report mentions in reports that don't belong to a group policy.
Please re-state the problem that we are trying to solve in this issue.
Stop highlighting report mentions in non policy rooms in the Composer
What is the root cause of that problem?
In here, we apply the mentionReport style without checking if the report belongs to policy or not, that leads to 2 bug:
Main bug in this issue: While typing a report mention in the composer in a DM or group chat the mention is highlighted, even though it is not possible to mention a report in this types o chats.
In policy room chat, when typing any room name that does not belong to the policy, the typed text is still highlighted. Then send a message. That message is still highlighted until the API AddComment is successful.
What changes do you think we should make in order to solve the problem?
We should create a new function to check if the typed text matches the suggestedMentions.
For example, assume that the suggestedMentions contains a few options: [announce, admin, room-1, room-2, room-3] then if user types #room-1, the typed text is highlighted.
If user types room-4, the typed text is not highlighted because there is no option is room-4.
Here is the implementation:
Create a function:
function doesRoomExisted(roomName: string, listRoomName: string[]) {
return listRoomName.includes(roomName);
}
which its inputs are the roomName and listRoomName, and return the boolean value to know if the given room named belongs to the current policy or not . In there above example, doesRoomExisted('room-1', ['announce', 'admin', 'room-1', 'room-2', 'room-3']) returns true
this step is straightforward so I do not implement the details. The main idea of this step is we will check if the typed text exists in the list room that can be mentioned. If true, apply the highlight style.
Also, we need to apply the change in .native.ts file
Now our main bug is fixed. But there is another issue that I mentioned in the RCA section. For example in the above example is room-4, that message is highlighted for a while before the AddComment is called successfully. It is because in here, we apply the mention-report tag in case of isGroupPolicyReport. We should use doesRoomExisted along with doesRoomExisted
What alternative solutions did you explore? (Optional)
@rlinoz I found another related bug: In policy room chat, when typing any room name that does not belong to the policy, the typed text is still highlighted. Then send a message. That message is still highlighted until the API AddComment is successful.
Hi @nkdengineer I think it's not actually a bug - If there is no rrom with such a name, we will send actionable whisper with an option to create it. Checking for the room existance is not a valid one in this case. CMIIW
@rlinoz I've created draft PR for this one. I went with more general solution and implement the rule excluding mechanism. Feel free to test and comment - I'll add the remaining screenshots and the rest later today.
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.82-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
[@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@JmillsExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
[@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
No offending PR.
[@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
The regression step should be enough.
[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Enter to group chat from the group policy
Try typing the report mention (for example #room-name)
Verify that the report mentioned is styled
Enter to 1:1 chat which is not part of group policy
Try typing report mention (for example #room-name)
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ImprovementItem broken or needs improvement.
Activity
ShridharGoel commentedon May 6, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Need to stop highlighting report mentions in non policy rooms.
What is the root cause of that problem?
As of now, mentionReport is always using
theme.mentionTextandtheme.mentionBGin the markdown style which leads to the highlighting.App/src/hooks/useMarkdownStyle.ts
Lines 52 to 55 in ab1e924
What changes do you think we should make in order to solve the problem?
We'll add a new argument to
useMarkdownStyle.Updated logic for styles of
mentionReport:Pass
isGroupPolicyReportas a prop to Composer viaComposerWithSuggestions.We'll update Composer function signature in both index.tsx and index.native.tsx.
Now, we can pass the same to useMarkdownStyle as the value of
shouldUseMentionReportby updating this code: Link.We'll do the same in index.native.tsx also:
App/src/components/Composer/index.native.tsx
Line 37 in ab1e924
robertKozik commentedon May 6, 2024
Hi @rlinoz! I'll look into it
nkdengineer commentedon May 6, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
mentionReportstyle without checking if the report belongs to policy or not, that leads to 2 bug:Main bug in this issue: While typing a report mention in the composer in a DM or group chat the mention is highlighted, even though it is not possible to mention a report in this types o chats.
In policy room chat, when typing any room name that does not belong to the policy, the typed text is still highlighted. Then send a message. That message is still highlighted until the API
AddCommentis successful.What changes do you think we should make in order to solve the problem?
We should create a new function to check if the typed text matches the suggestedMentions.
For example, assume that the
suggestedMentionscontains a few options:[announce, admin, room-1, room-2, room-3]then if user types#room-1, the typed text is highlighted.If user types
room-4, the typed text is not highlighted because there is no option isroom-4.Here is the implementation:
which its inputs are the
roomNameandlistRoomName, and return the boolean value to know if the given room named belongs to the current policy or not . In there above example,doesRoomExisted('room-1', ['announce', 'admin', 'room-1', 'room-2', 'room-3'])returnstruethis step is straightforward so I do not implement the details. The main idea of this step is we will check if the typed text exists in the list room that can be mentioned. If true, apply the highlight style.
Also, we need to apply the change in
.native.tsfileroom-4, that message is highlighted for a while before theAddCommentis called successfully. It is because in here, we apply themention-reporttag in case ofisGroupPolicyReport. We should usedoesRoomExistedalong withdoesRoomExistedWhat alternative solutions did you explore? (Optional)
nkdengineer commentedon May 6, 2024
I updated the proposal
rlinoz commentedon May 6, 2024
Sorry we aligned on Slack that this one should go to Robert since he was the one adding the styling to report mentions.
nkdengineer commentedon May 6, 2024
@rlinoz I found another related bug: In policy room chat, when typing any room name that does not belong to the policy, the typed text is still highlighted. Then send a message. That message is still highlighted until the API AddComment is successful.
Can you confirm if it is a bug? Thanks
robertKozik commentedon May 7, 2024
Hi @nkdengineer I think it's not actually a bug - If there is no rrom with such a name, we will send actionable whisper with an option to create it. Checking for the room existance is not a valid one in this case. CMIIW
nkdengineer commentedon May 7, 2024
@robertKozik This feature is not implemented in staging, right? (So I think It will be handled in the future).
Thanks for your information!
robertKozik commentedon May 7, 2024
I believe frontend implementation is already merged, only backend part is not yet in staging. But I'm not so up-to-date on it 😄
robertKozik commentedon May 7, 2024
@rlinoz I've created draft PR for this one. I went with more general solution and implement the rule excluding mechanism. Feel free to test and comment - I'll add the remaining screenshots and the rest later today.
49 remaining items
melvin-bot commentedon Jun 13, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.82-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-06-20. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jun 13, 2024
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
JmillsExpensify commentedon Jun 19, 2024
@mollfpr would you like to get us kicked off for the BZ checklist?
melvin-bot commentedon Jun 20, 2024
Payment Summary
Upwork Job
BugZero Checklist (@JmillsExpensify)
mollfpr commentedon Jun 22, 2024
No offending PR.
The regression step should be enough.
#room-name)#room-name)JmillsExpensify commentedon Jun 22, 2024
Confirming the payment summary above for $250 for @mollfpr. Regression test is also added, so closing this issue.
mallenexpensify commentedon Jun 24, 2024
Contributor: @mollfpr due $250 via NewDot
JmillsExpensify commentedon Jun 25, 2024
$250 approved for @mollfpr