-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Due for payment 2025-02-27] [$250] Workspace - Admin-users are displayed in the #Admins room members list after being deleted #56525
Comments
Triggered auto assignment to @bfitzexpensify ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Removed admin is still displayed on the admins room members. What is the root cause of that problem?When we remove the member from workspace, the API still return the removed user as the member of the admins report. This is a BE issue. However, on the FE, we also don't optimistically remove the user from the admins room. We currently only optimistically remove the user from the announce rooms. App/src/libs/actions/Policy/Member.ts Line 329 in 33a03bf
What changes do you think we should make in order to solve the problem?This should be fixed on the BE. For the optimistic part, we can create a new function called App/src/libs/actions/Policy/Member.ts Line 245 in 33a03bf
To use
This will optimistically mark the member as removed. We will need to add this when removing members ( For role update, we will only remove if we update the role to user/member.
I notice that we also don't optimistically add the admin to the admins room. If we would like to do it too, we can again follow a similar logic to App/src/libs/actions/Policy/Member.ts Line 678 in 33a03bf
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?We can test |
@bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Job added to Upwork: https://www.upwork.com/jobs/~021889445311434361818 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt ( |
@bernhardoj Thanks for the proposal. After a member is removed, the BE API response returns the correct |
@bernhardoj Sending Can you please try the following:
|
🎀 👀 🎀 Internal action required After removing an admin either by removing them from the workspace
This flow is also missing optimistic data, let's assign @bernhardoj for his proposal to fix that. |
Triggered auto assignment to @iwiznia, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@iwiznia Users that miss the onyx data that would be sent by the pusher will always get it in the |
Not quite, if you miss an update, the app will detect it later when it receives any other update and realizes the previousUpdateID returned in the update is higher than the last updateID the app applied. |
I added an admin (the account didn't exist before), then removed it. The request
Maybe the bug is related to this? Logs: If I logout and login, I don't see the removed admin in |
Hmmmm odd. I tested locally and the command worked, but the user was not unshared from the admins room |
hmm maybe a different bug. Did you add an existing account as an admin? |
This is a dupe |
From looking at #53390, it sounds like we are missing an onyx update to remove the admin from by "missing" I mean that we are not creating it |
I think not? At least from the tests above and the ones I did in dev, the user is never removed from the room. |
So.. from testing a bit more, I see the following:
Onyx updates response from DeleteMembersFromWorkspace{
"jsonCode": 200,
"requestID": "9117d2c50d084905-YVR",
"onyxData": [
{
"key": "report_999762946624637",
"onyxMethod": "merge",
"value": {
"participants": {
"19147050": {
"notificationPreference": "always"
},
"19147090": {
"notificationPreference": "always"
}
}
}
},
{
"key": "personalDetailsList",
"onyxMethod": "merge",
"value": {
"19147090": {
"accountID": 19147090,
"avatar": "https:\/\/d2k5nsl2zxldvw.cloudfront.net\/images\/avatars\/default-avatar_11.png",
"displayName": "aldo+testingadmininvite1@expensifail.com",
"firstName": "",
"lastName": "",
"login": "aldo+testingadmininvite1@expensifail.com",
"phoneNumber": "",
"pronouns": "",
"status": null,
"timezone": {
"automatic": true,
"selected": "America\/Vancouver"
},
"validated": true
}
}
},
{
"key": "report_999762946624637",
"onyxMethod": "merge",
"value": {
"lastReadTime": "2025-02-13 21:13:36.959"
}
},
{
"key": "reportActions_999762946624637",
"onyxMethod": "merge",
"value": {
"9113622837979361014": {
"actionName": "CLOSED",
"actorAccountID": 19147090,
"avatar": "https:\/\/d2k5nsl2zxldvw.cloudfront.net\/images\/avatars\/default-avatar_11.png",
"created": "2025-02-13 21:13:36.957",
"lastModified": "2025-02-13 21:13:36.957",
"message": [
{
"style": "normal",
"text": "aldo+testingadmininvite1@expensifail.com closed this report",
"type": "TEXT"
}
],
"originalMessage": {
"isNewDot": true,
"lastModified": "2025-02-13 21:13:36.957",
"policyName": "Expensifail's Workspace",
"reason": "removedFromPolicy"
},
"person": [
{
"style": "strong",
"text": "aldo+testingadmininvite1@expensifail.com",
"type": "TEXT"
}
],
"reportActionID": "9113622837979361014",
"shouldShow": true
}
}
},
{
"key": "report_999762946624637",
"onyxMethod": "merge",
"value": {
"private_isArchived": "2025-02-13 21:13:36.959"
}
},
{
"key": "reportNameValuePairs_999762946624637",
"onyxMethod": "merge",
"value": {
"private_isArchived": "2025-02-13 21:13:36.959"
}
},
{
"key": "reportDraftComment_999762946624637",
"onyxMethod": "merge",
"value": null
},
{
"key": "reportDraftCommentNumberOfLines_999762946624637",
"onyxMethod": "merge",
"value": null
},
{
"key": "report_999762946624637",
"onyxMethod": "merge",
"value": {
"oldPolicyName": "Expensifail's Workspace"
}
},
{
"key": "policy_D7846317A49F5F42",
"onyxMethod": "merge",
"value": {
"employeeList": {
"aldo+testingadmininvite1@expensifail.com": null
}
}
},
{
"key": "report_4488477575519198",
"onyxMethod": "merge",
"value": {
"participants": {
"19147050": {
"notificationPreference": "always"
}
}
}
},
{
"key": "personalDetailsList",
"onyxMethod": "merge",
"value": {
"19147050": {
"accountID": 19147050,
"avatar": "https:\/\/d2k5nsl2zxldvw.cloudfront.net\/images\/avatars\/default-avatar_19.png",
"displayName": "aldo+testingadmininvite@expensifail.com",
"firstName": "",
"lastName": "",
"login": "aldo+testingadmininvite@expensifail.com",
"phoneNumber": "",
"pronouns": "",
"status": null,
"timezone": {
"automatic": true,
"selected": "America\/Vancouver"
},
"validated": true
}
}
},
{
"key": "report_4488477575519198",
"onyxMethod": "merge",
"value": {
"lastReadTime": "2025-02-13 21:13:36.965"
}
},
{
"key": "report_4488477575519198",
"onyxMethod": "merge",
"value": {
"chatType": "policyAdmins",
"description": "",
"lastActorAccountID": 19147050,
"lastMessageText": "removed admin aldo+testingadmininvite1@expensifail.com",
"lastVisibleActionCreated": "2025-02-13 21:13:36.962",
"managerID": null,
"ownerAccountID": 0,
"parentReportActionID": null,
"parentReportID": null,
"policyID": "D7846317A49F5F42",
"reportID": "4488477575519198",
"reportName": "#admins",
"state": "OPEN",
"stateNum": 0,
"statusNum": 0,
"type": "chat",
"visibility": null
}
},
{
"key": "reportActions_4488477575519198",
"onyxMethod": "merge",
"value": {
"6125216547896740044": {
"actionName": "POLICYCHANGELOG_DELETE_EMPLOYEE",
"actorAccountID": 19147050,
"avatar": "https:\/\/d2k5nsl2zxldvw.cloudfront.net\/images\/avatars\/default-avatar_19.png",
"created": "2025-02-13 21:13:36.962",
"lastModified": "2025-02-13 21:13:36.962",
"message": [
{
"html": "",
"text": "",
"type": "COMMENT",
"whisperedTo": []
}
],
"originalMessage": {
"accountID": "19147090",
"email": "aldo+testingadmininvite1@expensifail.com",
"isNewDot": true,
"lastModified": "2025-02-13 21:13:36.962",
"name": "",
"role": "admin"
},
"person": [
{
"style": "strong",
"text": "aldo+testingadmininvite@expensifail.com",
"type": "TEXT"
}
],
"reportActionID": "6125216547896740044",
"shouldShow": true
}
}
},
{
"key": "report_8463558605722124",
"onyxMethod": "merge",
"value": {
"participants": {
"19147050": {
"notificationPreference": "always"
},
"19147087": {
"notificationPreference": "always"
},
"19147090": null
}
}
},
{
"key": "report_999762946624637",
"onyxMethod": "merge",
"value": {
"oldPolicyName": "Expensifail's Workspace",
"stateNum": 0,
"statusNum": 0
}
},
{
"key": "report_4488477575519198",
"onyxMethod": "merge",
"value": {
"lastActorAccountID": 19147050,
"lastMentionedTime": null,
"lastMessageText": "removed admin aldo+testingadmininvite1@expensifail.com",
"lastReadTime": "2025-02-13 21:13:36.962",
"lastVisibleActionCreated": "2025-02-13 21:13:36.962",
"maxSequenceNumber": null,
"reportID": "4488477575519198"
}
},
{
"key": "reportActions_4488477575519198",
"onyxMethod": "merge",
"shouldNotify": false,
"value": {
"6125216547896740044": {
"actionName": "POLICYCHANGELOG_DELETE_EMPLOYEE",
"actorAccountID": 19147050,
"automatic": false,
"avatar": "https:\/\/d2k5nsl2zxldvw.cloudfront.net\/images\/avatars\/default-avatar_19.png",
"created": "2025-02-13 21:13:36.962",
"isAttachment": false,
"lastModified": "2025-02-13 21:13:36.962",
"message": [
{
"deleted": "",
"html": "removed admin aldo+testingadmininvite1@expensifail.com",
"isDeletedParentAction": false,
"isEdited": false,
"reactions": [],
"text": "removed admin aldo+testingadmininvite1@expensifail.com",
"type": "COMMENT",
"whisperedTo": []
}
],
"originalMessage": {
"accountID": "19147090",
"email": "aldo+testingadmininvite1@expensifail.com",
"isNewDot": true,
"lastModified": "2025-02-13 21:13:36.962",
"name": "",
"role": "admin"
},
"person": [
{
"style": "strong",
"text": "aldo+testingadmininvite@expensifail.com",
"type": "TEXT"
}
],
"reportActionID": "6125216547896740044",
"reportActionTimestamp": 1739481216962,
"sequenceNumber": null,
"shouldShow": true,
"timestamp": 1739481216,
"whisperedToAccountIDs": []
}
}
},
{
"key": "policy_D7846317A49F5F42",
"onyxMethod": "merge",
"value": {
"employeeList": {
"aldo+testingadmininvite1@expensifail.com": null
}
}
},
{
"key": "account",
"onyxMethod": "merge",
"value": {
"guideCalendarLink": null
}
}
],
"previousUpdateID": 4191716640,
"lastUpdateID": 4191719647
} Unrelated bug: If you have never logged into the admin account, and you remove it, the I have only tested in staging, not dev for now. |
I now see why my tests were wrong (had a problem in my VM). |
hmmmm I think the problem is that we are using merge instead of set?
But that won't ever remove the previous participant. |
ok yeah, that was wrong. I am almost sure the code is here which is quite weird as this is very high in the call chain. |
Oh no, that's for the announce room (that I assume has the same bug, but will test) |
PR to fix the backend here https://github.com/Expensify/Auth/pull/14185 |
I would have expected that we would push a merge with:
to specifically remove the |
🤔 that would make sense, but that's not what we do at all.... |
Well, if you want to explore that, I think a good place to create the update setting the participant to |
FE PR is ready cc: @s77rt |
ok my fix was totally wrong, so back to the drawing board.
Looking more at the code, I see some updates are here but that's only for the announce room, which I don't see why should have any special logic (ie: this should've been done in Now the question is: should I add the update to the lowest level |
I see that this was originally added here and it indeed has a question from @flodnv questioning why this is only for announce and not in the lowest level. Seems like the reasoning was: I want a smaller change rather than a big one. @marcaaron what do you think? Should we undo that and move this to |
@marcaaron is on parental leave until April 1st 🙃 I still think it makes more sense to have this at the deepest level. |
The more I look into the code, the more confused I am. I just discovered Report::queueOnyxUpdatesForInvitedMembers, which also seems to be doing something similar and also not called in the lowest level. |
I had this PR before I discovered that |
|
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.1-6 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 2025-02-27. 🎊 For reference, here are some details about the assignees on this issue:
|
@s77rt @bfitzexpensify @s77rt The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.0.95-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
Issue reported by: Applause Internal Team
Device used: Mac 15.2/Safari
App Component: Workspace Settings
Action Performed:
Expected Result:
Admin-users are not displayed in the #Admins room members list after being deleted from the workspace
Actual Result:
Admin-users are displayed in the #Admins room members list after being deleted from the workspace
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6735801_1738893869509.Recording__580.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @bfitzexpensifyThe text was updated successfully, but these errors were encountered: