Page MenuHomePhabricator

[keyserver] introduce setSubcriptionToDefault option in changeRole
ClosedPublic

Authored by ginsu on Fri, Jun 14, 2:53 PM.
Tags
None
Referenced Files
F2108932: D12444.id41344.diff
Tue, Jun 25, 2:51 PM
F2107588: D12444.diff
Tue, Jun 25, 10:42 AM
F2100276: D12444.id41466.diff
Mon, Jun 24, 6:54 PM
F2100147: D12444.id41476.diff
Mon, Jun 24, 6:19 PM
Unknown Object (File)
Mon, Jun 24, 12:38 PM
Unknown Object (File)
Mon, Jun 24, 3:31 AM
Unknown Object (File)
Sun, Jun 23, 8:05 PM
Unknown Object (File)
Sun, Jun 23, 7:07 PM
Subscribers

Details

Summary

This diff introduces a new optional option in changeRole called setSubcriptionToDefault. When setSubcriptionToDefault is set to true the subscription for the membership row will be the default subscription where home and pushNotifs are set to false

Depends on D12065

Test Plan

Please see the demo video below where I use this option to have auto joined communities be set in the background tab

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ginsu retitled this revision from [keyserver] introduce setSubcriptionToBackground option in changeRole to [keyserver] introduce setSubcriptionToDefault option in changeRole.Fri, Jun 14, 3:09 PM
ginsu edited the summary of this revision. (Show Details)
ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: ashoat, kamil.
ginsu requested review of this revision.Fri, Jun 14, 3:22 PM
ashoat requested changes to this revision.Fri, Jun 14, 5:15 PM
ashoat added inline comments.
keyserver/src/updaters/thread-permission-updaters.js
85 ↗(On Diff #41346)

Typo: Subcription should be Subscription

Can we actually do this instead here?

// This will only be set if the user is joining or leaving the thread
// Joined means role > 0
+defaultSubscription: ThreadSubscription,

And then pass in { home: false, pushNotifs: false } for defaultSubscription.

I think this is clearer at the callsite (less ambiguity about what "default" means) and more flexible/powerful.

This revision now requires changes to proceed.Fri, Jun 14, 5:15 PM
keyserver/src/updaters/thread-permission-updaters.js
88 ↗(On Diff #41430)

Made defaultSubscription optional so that devs aren't forced to add this as part of the ChangeRoleOptions object if they use another option

915 ↗(On Diff #41430)

This is used when the membership intent is to leave + in the deleteMemberships function below. Feel like renaming this variable more specifically for this use case made sense and is more clear

Please undo the rename before landing

keyserver/src/updaters/thread-permission-updaters.js
915 ↗(On Diff #41430)

Let's rename it back. This isn't just used for intent === 'leave'... it's also used for when intent is not set, which is why it's considered a default

This revision is now accepted and ready to land.Tue, Jun 18, 9:46 AM