Page MenuHomePhabricator

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

Authored by tomek on Thu, Sep 26, 4:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 27, 9:11 AM
Unknown Object (File)
Fri, Sep 27, 9:11 AM
Unknown Object (File)
Fri, Sep 27, 9:11 AM
Unknown Object (File)
Fri, Sep 27, 9:08 AM
Unknown Object (File)
Fri, Sep 27, 9: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 ↗(On Diff #44599)

The message is already included in JOIN_THREAD

tomek requested review of this revision.Thu, Sep 26, 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.Thu, Sep 26, 8:13 AM