Page MenuHomePhabricator

[lib] Handle a case where viewer is added to a thread while being its member
ClosedPublic

Authored by tomek on Sep 26 2024, 4:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 17, 8:01 AM
Unknown Object (File)
Fri, Nov 8, 3:02 AM
Unknown Object (File)
Fri, Nov 8, 3:02 AM
Unknown Object (File)
Fri, Nov 8, 3:02 AM
Unknown Object (File)
Fri, Nov 8, 3:00 AM
Unknown Object (File)
Fri, Nov 1, 4:22 PM
Unknown Object (File)
Oct 21 2024, 6:59 AM
Unknown Object (File)
Oct 21 2024, 5:34 AM
Subscribers

Details

Summary

It is possible that we receive an operation about viewer being added to a thread while the thread is already present in the store and viewer is its member. We need to make sure that we don't override the whole thread and instead update it as little as possible.

https://linear.app/comm/issue/ENG-8720/add-protection-against-thick-thread-creation-overwriting-existing

Depends on D13483

Test Plan

Create a sidebar, add, remove, and add a user and check on that user's device if the thread is displayed and updated correctly.

Diff Detail

Repository
rCOMM Comm
Branch
improvements2
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

lib/shared/dm-ops/add-viewer-to-thread-members-spec.js
183–189 ↗(On Diff #44599)

The message is already included in JOIN_THREAD

tomek requested review of this revision.Sep 26 2024, 4:33 AM
ashoat added inline comments.
lib/shared/dm-ops/add-members-spec.js
58 ↗(On Diff #44599)

Nit: shorthand

lib/shared/dm-ops/add-viewer-to-thread-members-spec.js
117 ↗(On Diff #44599)

Unrelated to this diff, but I did some investigation as to why we still have permissions for members here.

The context is that in D12789, we removed member permissions from the SQLite DB on native clients.

I know Atul never finished it, but I was under the impression that the only thing left was to implement an equivalent migration on web.

However, looking at the types it seems like the changes were made for thin threads but NOT for thick threads.

I'm guessing Atul's work intersected with the thick threads work, and he ended up making the changes only for thin threads.

I'm not 100% sure, but I suspect we should probably do the same for thick threads as thin threads (calculate the member permissions "on the fly") instead of storing them in the DB. I created ENG-9404 to track this.

This revision is now accepted and ready to land.Sep 26 2024, 8:13 AM