Page MenuHomePhabricator

[keyserver] introduce setSubcriptionToDefault option in changeRole
ClosedPublic

Authored by ginsu on Jun 14 2024, 2:53 PM.
Tags
None
Referenced Files
F3149094: D12444.id41344.diff
Mon, Nov 4, 1:07 PM
Unknown Object (File)
Sat, Nov 2, 1:38 AM
Unknown Object (File)
Fri, Nov 1, 7:20 PM
Unknown Object (File)
Mon, Oct 28, 11:34 AM
Unknown Object (File)
Thu, Oct 24, 4:49 AM
Unknown Object (File)
Wed, Oct 23, 4:57 AM
Unknown Object (File)
Wed, Oct 23, 4:26 AM
Unknown Object (File)
Sun, Oct 20, 3:23 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
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu retitled this revision from [keyserver] introduce setSubcriptionToBackground option in changeRole to [keyserver] introduce setSubcriptionToDefault option in changeRole.Jun 14 2024, 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.Jun 14 2024, 3:22 PM
ashoat requested changes to this revision.Jun 14 2024, 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.Jun 14 2024, 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.Jun 18 2024, 9:46 AM