Open lanitochka17 opened 9 months ago
Job added to Upwork: https://www.upwork.com/jobs/~0197a54c54a4f9ab7b
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External
)
Deleted announce room is not removed from LHN for employee
The root cause is that when a policy is deleted and User B receives update from WS, the handler doesn't remove the report from Oynx storage.
Update /src/libs/actions/Policy.ts#L76 to update the #announce report value to null
.
β On a side note, wanted to confirm with the team whether we want to remove all related reports when a policy is deleted, as opposed to only remove the #announce report.
https://github.com/Expensify/App/blob/main/src/libs/actions/Policy.ts#L76
Alternatively, we could send an update from server to update the related reports to null. But it depends on how the backend logic really is. If after policy deletion, backend will not send anything about the related reports to frontend again, then doing it on frontend makes more sense.
π£ @cheng-kang! π£ Hey, it seems we donβt have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Your Expensify account email: cantchengkang@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~017f672cbef45659ec
β Contributor details stored successfully. Thank you for contributing to Expensify!
Can we a BZ here cc: @Expensify/bug-zero
@cheng-kang
Update /src/libs/actions/Policy.ts#L76 to update the #announce report value to null.
Why do we want to do this? How we would do this?
Can you explain how this works, thanks!
@Santhosh-Sellavel
Update /src/libs/actions/Policy.ts#L76 to update the #announce report value to null.
Why do we want to do this? How we would do this?
Can you explain how this works, thanks!
The announce room stays there because the related report
still exists in Onyx cache. To remove it from the list, we should remove it from the Onyx cache after workspace deletion.
Triggered auto assignment to @adelekennedy (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
@Santhosh-Sellavel
Update /src/libs/actions/Policy.ts#L76 to update the #announce report value to null.
Why do we want to do this? How we would do this? Can you explain how this works, thanks!
The announce room stays there because the related
report
still exists in Onyx cache. To remove it from the list, we should remove it from the Onyx cache after workspace deletion.
@cheng-kang How we would do this?
@Santhosh-Sellavel by updating /src/libs/actions/Policy.ts#L76 to set the #announce report value to null.
If we are only interested in the announce channel, we will add a check there to only set the value for the specific report to be null
.
Otherwise, if we want to remove all related channels, we can just make change to the line referenced and make all reports to null.
@cheng-kang
@Santhosh-Sellavel by updating /src/libs/actions/Policy.ts#L76 to set the #announce report value to null.
How would set announce to null there, can you share the snippet?
@adelekennedy
Can you check internally & answer this?
On a side note, wanted to confirm with the team whether we want to remove all related reports when a policy is deleted, as opposed to only remove the #announce report.
@Santhosh-Sellavel would be a simple one line change https://github.com/Expensify/App/blob/main/src/libs/actions/Policy.ts#L76
- cleanUpMergeQueries[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`] = {hasDraft: false};
+ cleanUpMergeQueries[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`] = null;
cleanUpMergeQueries
will be merged into Onyx cache and remove the report, UI that subscribes to reports will be updated to the new list without the reports from deleted workspace
I get this would make all workspace reports go from LHN
@Santhosh-Sellavel for announce channels only we can check if type === "chat" && chatType === "policyAnnounce"
@Santhosh-Sellavel
Yep, as it stands, #announce should be unshared with all members apart from the workspace admins at the time of deletion
Current Status: We need a better proposal here.
I'm unavailable next week, Please assign a new C+ Issue here if required while I am away, thanks!
cc: @adelekennedy
@Santhosh-Sellavel hi do you mind provide more details on what's expected in a proposal? Or what's the issue with the current proposal? Is it not pointing to the right root cause? Or is it not including enough details? Would love to understand it better so I can better contribute. Thanks.
@cheng-kang Sorry I might be confused with something else,
Your proposal might be good here, but its bits & part please regroup and submit an updated proposal for hiding only announce report in a new comment with complete solution.
Deleted announce room is not removed from LHN for employee
The root cause is that when a policy is deleted and User B receives update from WS, the handler doesn't remove the report from Oynx storage.
The announce room stays there because the related report still exists in Onyx cache. To remove it from the list, we should remove it from the Onyx cache after workspace deletion, by updating /src/libs/actions/Policy.ts#L76 to update the #announce report value to null
.
To remove only the announce channel, we should check if type === "chat" && chatType === "policyAnnounce"
.
policyReports.forEach((policyReport) => {
if (!policyReport) {
return;
}
const {reportID} = policyReport;
+ // Remove the announce channel
+ if (policyReport.type === 'chat' && policyReport.chatType === 'policyAnnounce') {
+ cleanUpMergeQueries[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`] = null;
+ } else {
+ cleanUpMergeQueries[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`] = {hasDraft: false};
+ }
- cleanUpMergeQueries[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`] = {hasDraft: false};
cleanUpSetQueries[`${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`] = null;
cleanUpSetQueries[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${reportID}`] = null;
});
cleanUpMergeQueries
will be merged into Onyx cache and remove the report, UI that subscribes to reports will be updated to the new list without the announce channel report from deleted workspace.
No need to check for room ownership because this part is only run for room participants when the workspace is removed locally, the workspace is not removed locally for admin and only marked as archived.
https://github.com/Expensify/App/blob/main/src/libs/actions/Policy.ts#L76
Alternatively, we could send an update from server to update the related reports to null. But it depends on how the backend logic really is. If after policy deletion, backend will not send anything about the related reports to frontend again, then doing it on frontend makes more sense.
Note: consolidated proposal from initial proposal and following comments as requested by @Santhosh-Sellavel
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
holding on this - @Santhosh-Sellavel will be back in a week
@cheng-kang's proposal looks good!
We can make use of ReportUtils.isAnnounceRoom
method to check #announce room.
C+ Reviewed π π π
Triggered auto assignment to @pecanoro, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@pecanoro @adelekennedy @Santhosh-Sellavel this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
I am wondering, how is this a problem for the announce room but not the other policy rooms or the admins room? What happens in those cases?
@pecanoro Check this internal thread
@pecanoro Any update have you discussed it on the thread?
cc: @adelekennedy
@pecanoro @adelekennedy @Santhosh-Sellavel this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!
Oh sorry, I forgot to look into this, I will check the thread today
@adelekennedy Unassigning as am planning for OOO, please assign a new C+ here.
I am interested as C+ as this looks similar to #35751 I was reviewing (but not same).
@pecanoro @adelekennedy this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:
Thanks!
Triggered auto assignment to Contributor Plus for review of internal employee PR - @sobitneupane (Internal
)
Sorry for the delay, I lost track of this issue, my bad! After reviewing some things, yes, proposal sounds good, assigning!
Current assignee @sobitneupane is eligible for the External assigner, not assigning anyone new.
Issue not reproducible during KI retests. (First week)
π£ @aimane-chnaif π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
@aimane-chnaif so sorry! This slipped through while I was ooo last week - added you to the issue here but noting that you are the C+
Is this still reproducible?
@pecanoro, @cheng-kang, @adelekennedy, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!
@lanitochka17 can you please confirm if this is still reproducible on latest staging?
@aimane-chnaif Hello Issue is still reproducible. Announce room is not removed when deleting the workspace but it is removed when removing a member
https://github.com/Expensify/App/assets/78819774/88665a45-67dc-4d24-8518-f5ad80963435
@cheng-kang how's it going?
@cheng-kang Last ping before I open it back to other people since we haven't heard from you
Opening back to contributors since we haven't heard back in a while
@pecanoro @aimane-chnaif, I can help implementing the selected proposal if needed. Thanks
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: 1.4.29-0 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:
Expected Result:
Announce room should be removed from LHN of user B
Actual Result:
Announce room is removed when user B opens the room, and navigates to another chat
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/173c8244-c5c6-4d2e-af09-4b15af985ba5
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @srikarparsi