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
F3390283: D13490.diff
Fri, Nov 29, 11:09 PM
F3390023: D13490.id44624.diff
Fri, Nov 29, 9:41 PM
F3387882: D13490.id44600.diff
Fri, Nov 29, 11:40 AM
F3386677: D13490.id44627.diff
Fri, Nov 29, 5:41 AM
F3386394: D13490.id44623.diff
Fri, Nov 29, 4:29 AM
Unknown Object (File)
Thu, Nov 28, 1:28 PM
Unknown Object (File)
Tue, Nov 26, 8:58 PM
Unknown Object (File)
Sun, Nov 17, 8:01 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

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

Nit: shorthand

lib/shared/dm-ops/add-viewer-to-thread-members-spec.js
117

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