Repository navigation
feat: auto subscribe switch - #1593
Conversation
👇 Click on the image for a new way to code review
Legend |
f9c86fc to
6d81bca
Compare
There was a problem hiding this comment.
When reviewing, I noticed that profiles isn't sectioned, so it's hard to distinguish what something is for, and it feels chaotic.
But this is for a different pull request, I didn't find issues, only small nitpick which I am okay with this going through with dismissing as well.
Edit: I meant this as a comment, not as approval sorry for the confusion 🤦 😅
ojeytonwilliams
left a comment
There was a problem hiding this comment.
More of a question than a suggestion, but what do you think to including auto_subscribe updates in updateMe? It cuts down on the number of resolvers, hooks and so on.
| ctx.user.user_chapters.find( | ||
| (user_chapter) => user_chapter.chapter_id === chapterId, | ||
| )?.subscribed ?? true; | ||
| )?.subscribed || ctx.user.auto_subscribe; |
There was a problem hiding this comment.
| )?.subscribed || ctx.user.auto_subscribe; | |
| )?.subscribed ?? ctx.user.auto_subscribe; |
Otherwise if subscribed is false then this will fall back to auto_subscribe.
There was a problem hiding this comment.
Generally that was the idea, when auto_subscribe === true, it subscribes when joining chapters and RSVPing to event. Regardless of the chapterUser.subscribed of the event's chapter.
But it can be changed to give chapterUser.subscribed precedence. In such case actually auto_subscribe won't be needed here at all, as chapterUser is always created before eventUser.
There was a problem hiding this comment.
Ah, right. So, this is a tricky one because it's important to avoid sending emails when a user thinks they've unsubscribed. But it's also important that we have sensible defaults.
As a user, when I unsubscribe from a Chapter, I expect that Chapter to stop communicating with me. However, if I then RSVP to an Event, do I want notifications about that specific Event, even though I don't want them from the Chapter generally? Maybe, but I think we need to let people opt-in.
Another issue with the existing logic is how we communicate what it does. We'd have to say something like
Automatically enable email notifications when you join a chapter or RSVP to an event (even if you are not subscribed to the chapter hosting that event).
vs.
Automatically enable email notifications from a chapter when you join.
Since we really want to encourage users to turn on notifications, I think it's important that the setting that does is transparent.
There was a problem hiding this comment.
I feel like the RSVP notifications and chapter notifications shouldn't impact each other.
If someone turns off chapter.subscribed, then they are turning off new event announcements, general announcements, and anything else an organizer might send to everyone. I don't think that would disable RSVP related email notifications just like it wouldn't un-RSVP a person from an event.
@ojeytonwilliams 's suggestion to add labels to make things clear is probably the only way we can avoid confusion.
Just a first pass at it
Chapter Page
Would you like to turn off email updates for new event and general announcements for this Chapter?
RSVP Page / Form
Would you like to stop all email updates for this event, including changes and cancellations?
There was a problem hiding this comment.
Actually, I updated the suggestions so both are asking about disabling emails, like "turn off" and "stop". We could very well make them both affirmative, like "enable" and "turn on", but it's probably good to do things in a similar format.
I guess it depends on the form element being used and even the current state of the element. Like, could we change the language of the label based on the state? For example, if it's on, then ask "Would you like to turn off". If it's off, then ask "Would you like to turn on?".
Since we're talking about "Switches" I wanted to repost the earlier conversation about form element selection and about toggling notifications on and off as it was related to emails. It looks like we even explored the use of the word "Follow {Chapter Name}" instead of "Subscribe" vs "Unsubscribe". I'm not suggesting we change the schema, just that we might use words for the user that help add to the context.
Facebook uses "Follow" and Meetup uses "Join" and the current UI has "Subscribe" vs "Unsubscribe".
One somewhat confusing thing is when you toggle "Subscribe" on it says "member of the chapter". So, does that mean if you unsubscribe that you're no longer a member? I'd imagine you can be a member of the group, and just not get notifications, but that may open a can of worms for the MVP.
#107 (comment)
#107 (comment)
https://mui.com/material-ui/react-switch/#switches-with-formcontrollabel
#107 (comment)
There was a problem hiding this comment.
Also, given the types of custom switch designs where you have "On" and "Off", perhaps using a question format for a label, like I suggested above, isn't good with switches.
I know we're using Chakra, but the Material UI docs show what you can do with custom switches like having a checkmark in the switch, or the "On" and "Off" labels.
There was a problem hiding this comment.
@allella that's a good point about the separation between Chapter and Event notifications. If we make it clear what turning off Chapter notifications does, then it's probably fine to have clicking on RSVP to tacitly accept that you're going to get emails about that Event.
We will need to make this configurable sooner rather than later, though not necessarily for the MVP.
Also, though I've not tested this properly, certain notifications are sure to overlap with the notifications coming from Google Calendar. We'll have to experiment a bit to make sure users can get the emails they want.
I know we're using Chakra, but the Material UI docs show what you can do with custom switches like having a checkmark in the switch, or the "On" and "Off" labels.
We should be careful we don't customize switches too much, but something like what you shared below looks good. I don't know how straightforward that would be to implement, though.
Finally, I'm not sure which word (follow or subscribe) works best. That might be something we discover through user testing.
There was a problem hiding this comment.
So, for this PR, I think the consensus is the following.
- Chapter subscription should control if a user gets new event notifications
- Events should be subscribed to when a user clicks RSVP, regardless of Chapter subscription
We can handle further notification configuration separately (maybe post MVP).
There was a problem hiding this comment.
For MVP, I'd agree new event notifications are the minimum. If / when organizers & admin can send an email to all Chapter members for a general announcements, then that would seem to fit under "subscribed to chapter notifications", at least until we break the controls down to smaller bits.
Part of our challenge with the switches for MVP is there may be more than one thing it turns on or off, as with the new events & general announcements example for a chapter.
Eventually, we can have more controls to allow a user / member to be more granular about their notification preferences, as in the screenshots of Facebook and Meetup examples.
For the RSVP, it looks like we don't give the member the option to turn off RSVP-related notifications until after they have hit the RSPV confirmation button.

That's fine, but eventually it may make sense to have the RSVP form with other options (media waiver, food preferences, and such, and that interface might also make sense to toggle on/off the RSVP notifications.
There was a problem hiding this comment.
To be honest I'm still not sure what to do with how auto subscribe works for events.
What I'm sure is that currently, when unsubscribing from chapter, user is also unsubscribed from events in that chapter. Because that should be slightly outside of this PR scope, I've created issue - #1639
- Chapter subscription should control if a user gets new event notifications
That's how it is, I believe. User has to be subscribed to chapter to receive emails about newly created events.
- Events should be subscribed to when a user clicks RSVP, regardless of Chapter subscription
As I understand this, it means always subscribing to events when RSVPing.
|
|
||
| const isSubscribedToEvent = userChapter ? userChapter.subscribed : true; // TODO add default event subscription setting override | ||
| const isSubscribedToEvent = | ||
| userChapter?.subscribed || ctx.user.auto_subscribe; |
There was a problem hiding this comment.
| userChapter?.subscribed || ctx.user.auto_subscribe; | |
| userChapter?.subscribed ?? ctx.user.auto_subscribe; |
Same principle.
|
Btw random question, should this function starts as Because we don't have an indication that this function exist, so people may be subscribing to email services without knowing, and we may be flagged as spam in the future. Edit: maybe that what |
|
@Sboonny yeah, that's a very good point. People need to opt-in to receiving email, so we'll need to have this default to false and do something similar to the main repo. That is to say, when people sign up for the first time, we should give them the option to receive emails from Chapter.
Nope, you will get notified (by email) about new events so that you can decide to go (which you do by RSVPing). |
|
I'm going to pull it into |
ojeytonwilliams
left a comment
There was a problem hiding this comment.
Just some nitpicks:
| export class UpdateUserInputs | ||
| implements Omit<User, 'id' | 'email' | 'auto_subscribe'> | ||
| { |
There was a problem hiding this comment.
| export class UpdateUserInputs | |
| implements Omit<User, 'id' | 'email' | 'auto_subscribe'> | |
| { | |
| export class UpdateUserInputs implements Omit<User, 'id' | 'email'> { |
We're using this, so there's no need to omit it.
| }, | ||
| }); | ||
|
|
||
| const eventSubscription = true; |
There was a problem hiding this comment.
| const eventSubscription = true; |
This seems redundant, now.
| rsvp: { connect: { name: newRsvpName } }, | ||
| event_role: { connect: { name: 'member' } }, | ||
| subscribed: isSubscribedToChapter, | ||
| subscribed: eventSubscription, |
There was a problem hiding this comment.
| subscribed: eventSubscription, | |
| subscribed: true, |
| // NOTE: this relies on there being an event_user record, so must follow | ||
| // that. | ||
| if (newRsvpName !== 'waitlist' && isSubscribedToChapter) { | ||
| if (newRsvpName !== 'waitlist' && eventSubscription) { |
There was a problem hiding this comment.
| if (newRsvpName !== 'waitlist' && eventSubscription) { | |
| if (newRsvpName !== 'waitlist') { |
|
I blocked this because it requires a db migration and I've not set up the workflows for that yet. |
Co-authored-by: Oliver Eyton-Williams <[email protected]>
| <FormControl> | ||
| <Flex> | ||
| <FormLabel htmlFor="auto_subscribe"> | ||
| Automatic chapter subscription |
There was a problem hiding this comment.
| Automatic chapter subscription | |
| Subscribing when joining chapters |
This is really tricky to word correctly, but this is my best attempt so far.
There was a problem hiding this comment.
I have two ideas going in a slightly different direction:
- Default chapter subscription
- Subscribe to chapters by default
What do you think? The helper text suggestion would work with these too.
There was a problem hiding this comment.
You know what, I think "Subscribe to chapters when joining them" might be the way to go. It's a bit verbose, but it at least gets across the point that 'joining' and 'subscribing' are two different things.
I've spent far too long thinking about this, though!
| ? 'Automatically subscribe to chapter when joining it and receive emails about new events in chapter.' | ||
| : "Don't automatically subscribe to joined chapters."} |
There was a problem hiding this comment.
| ? 'Automatically subscribe to chapter when joining it and receive emails about new events in chapter.' | |
| : "Don't automatically subscribe to joined chapters."} | |
| ? '(After joining a new chapter, you will be notified when new events are created.)' | |
| : '(After joining a new chapter, you will not be notified about new events unless you subscribe.)'} |
This way the information is describing the current state, rather than what will be the case once you click the button. I believe this is the most common pattern
Co-authored-by: Oliver Eyton-Williams <[email protected]>
|
Awesome, thanks @gikf. Did you have any issues creating the migration? Anyways, I'll get this in before I have second thoughts about the wording. |
|
@ojeytonwilliams Dunno if this was expected on the first run, but I had to use |





Update README.md).mainbranch of Chapter.true:Subscribes to event when RSVPing. (Currently regardless of the individual chapter subscription).false:Subscribing to event depends on chapter subscription. If chapter subscription was manually changed totrue, user will be subscribed to event when RSVPing.