App
App copied to clipboard
[$500] Web - The name 'fake' is added as a member when replying to a statement in the workspace chat
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.26-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:
Action Performed:
- Go to Settings > Workspace > New Workspace
- Observe the workspace chat created on LHN
- Enter the workspace chat, write any comment, and then reply to it
- Click on the header > Members > Notice that the additional 'fake' account is added as a member in the workspace chat
Expected Result:
The 'fake' account should not be added as a member
Actual Result:
The 'fake' name is added as a member when replying to a statement in the workspace chat
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Native
- [ ] Android: mWeb Chrome
- [ ] iOS: Native
- [ ] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/a9e02132-ecdd-4592-867f-f40b44a55eb3
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~012d728b680c6b95a5
- Upwork Job ID: 1747728578465234944
- Last Price Increase: 2024-01-17
Triggered auto assignment to @johncschuster (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Job added to Upwork: https://www.upwork.com/jobs/~012d728b680c6b95a5
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External
)
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workspace - The name 'fake' is added as a member when replying to a statement in the workspace chat
What is the root cause of that problem?
The main problem with this issue is that we do not filter the list of members by default As a result, we can get members with accountID which is equal 0
https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L4230-L4244
What changes do you think we should make to solve the problem?
To fix this issue we can add filter(Boolean)
for
https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L4243
And since visibleChatMemberAccountID for fake is 0 it will fix the problem
What alternative solutions did you explore? (Optional)
As alternative, we can make these changes and filter the list in ReportParticipantsPage
here
https://github.com/Expensify/App/blob/4b7b8f2480866200c64a8b614a1f485c0112aa11/src/pages/ReportParticipantsPage.js#L59
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workspace - The name 'fake' is added as a member when replying to a statement in the workspace chat.
What is the root cause of that problem?
As part of the OpenReport
API response, the backend returns the report.ownerAccountID
included in the report.visibleChatMemberAccountIDs
array.
This should only happen for the parent policy chat and not for chat threads. That is why this doesn't happen with chats or chat threads that do not have a policy associated with it.
https://github.com/Expensify/App/blob/4b7b8f2480866200c64a8b614a1f485c0112aa11/src/libs/ReportUtils.ts#L4238
Therefore, the report.getVisibleMemberIDs
function will return ownerAccountID
as a part of the visibleChatMemberAccountIDs
.
However, If the report was a money request, it will remove any fake members from the visibleChatMemberAccountIDs
array and return only visible members with avatars.
What changes do you think we should make in order to solve the problem?
This problem could be fixed at the backend, but here is a front end that would work as well and improve the report.getVisibleMemberIDs
function. It will fix the number of members in the ReportDetailsPage
and remove the fake member in the ReportParticipantsPage
.
We will change the condition above to look something similar to the one below.
if (isMoneyRequestReport(report) || (isPolicyExpenseChat(report) && isThread(report))){
POC (macOS - Chrome)
https://github.com/Expensify/App/assets/22982173/001fe39c-c1d1-433d-9ab1-a4058b5e8fe0
Proposal
Please re-state the problem that we are trying to solve in this issue.
The 'fake' name is added as a member when replying to a statement in the workspace chat
What is the root cause of that problem?
This is the data returned from OpenReport API
let's see 2 fields participantAccountIDs, visibleChatMemberAccountIDs: the 0
value caused this bug
What changes do you think we should make in order to solve the problem?
We should add a filter for these fields. In here, we should update like that https://github.com/Expensify/App/blob/4da7fdab30857d0934d8a8035f9e1c773385d950/src/libs/ReportUtils.ts#L4187
let visibleChatMemberAccountIDs = report.visibleChatMemberAccountIDs ?? [];
// Build participants list for IOU/expense reports
if (isMoneyRequestReport(report)) {
visibleChatMemberAccountIDs = [report.managerID, report.ownerAccountID, ...visibleChatMemberAccountIDs]
}
const onlyTruthyValues = visibleChatMemberAccountIDs.filter(Boolean) as number[];
return [...new Set([...onlyTruthyValues])];
I move the filter outside if block to dry code. We also need to update the same thing here https://github.com/Expensify/App/blob/4da7fdab30857d0934d8a8035f9e1c773385d950/src/libs/ReportUtils.ts#L4168-L4181
We also should do the same thing in here
What alternative solutions did you explore? (Optional)
NA
@ZhenjaHorbach's proposal looks good to me if frontend fix is fine.
filter(Boolean)
is already used here:
https://github.com/Expensify/App/blob/6e2f058b71d47a67397738054daee4604d753593/src/libs/ReportUtils.ts#L4402
So we can apply same to non money request reports as well.
Question for assigned engineer: I'd like to confirm why backend returns 0
in participantAccountIDs
and if it's intentional.
🎀 👀 🎀 C+ reviewed
Triggered auto assignment to @iwiznia, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
I think this link is wrong? Always use permalinks to code, otherwise it is very possible the link is wrong
I'd like to confirm why backend returns 0 in participantAccountIDs and if it's intentional.
Hmmm I think it's a mistake. Why would we want to do that?
Taking this internal
Current assignee @situchan is eligible for the Internal assigner, not assigning anyone new.
@iwiznia, @johncschuster Eep! 4 days overdue now. Issues have feelings too...
Chill out, Melvin. It looks like @iwiznia has a fix in place.
@iwiznia, @johncschuster Whoops! This issue is 2 days overdue. Let's get this updated quick!
@iwiznia, @johncschuster Eep! 4 days overdue now. Issues have feelings too...
@iwiznia, @johncschuster Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
Oh this is allegedly done, @lanitochka17 can you please re-test and check if the issue still exists and if not, close the issue?
@iwiznia, @johncschuster Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Bump @lanitochka17 https://github.com/Expensify/App/issues/34672#issuecomment-1953122387
@iwiznia Hello Issue is not reproducible now
https://github.com/Expensify/App/assets/78819774/09e5af96-6ccb-4996-b102-efa1ff891af6