Plots2: Option to not receive email notifications for topics you follow

Created on 27 Nov 2019  路  14Comments  路  Source: publiclab/plots2

Similarly to #4543, and in relation to #6787, we should make an option in https://publiclab.org/settings to turn off email notifications for topics you follow. You might still get notified via the Notifications API (like, smartphone notifications, etc), and you'd still see topics you follow listed on your dashboard (new dashboard at #6072).

New note email notifications are generated from this segment of code:

https://github.com/publiclab/plots2/blob/97d0142d9e8b8ceb62513e7f1a3471fdeadfa8da/app/mailers/subscription_mailer.rb#L8-L26

We need to modify this line, to make an exception for a) people who have a user tag showing they don't want to get email notifications for things they follow, so notifications:none perhaps? (we need to discuss/disambiguate this vs. the existing tags we use on the /settings page...)

https://github.com/publiclab/plots2/blob/97d0142d9e8b8ceb62513e7f1a3471fdeadfa8da/app/mailers/subscription_mailer.rb#L16

You can determine if a user has a tag like this:

UserTag.exists?(user.id, 'digest:weekly')

https://github.com/publiclab/plots2/blob/master/app/views/users/settings.html.erb

(Possibly useful links: The settings were previously worked on in https://github.com/publiclab/plots2/pull/2985/ and https://github.com/publiclab/plots2/pull/3119 and digests are sent from https://github.com/publiclab/plots2/blob/7e20e413e94925a4f021f14e61a36b7ebb270e25/app/jobs/digest_mail_job.rb)

break-me-up discussion feature help wanted

All 14 comments

Existing tags for this kind of thing are formatted like: notifications:mentioned so perhaps notifications:noemail (just so it specifically means no emails, as opposed to turning off other kinds of notifications)?

Then we'll need a UI on this page, https://publiclab.org/settings :

image

Noting we have to add an exemption for digest:daily and digest:weekly as well, while we're at it.

Basic switch for this purpose might be labeled:

Do you want to receive email notifications for topics you follow? [ ]

Screen Shot 2019-11-27 at 1 01 13 PM

So the switch we'd have to add to the subscription_mailer.rb file would be:

recipients += node.author.followers.collect(&:email) 
recipients -= UserTag.where(value: 'digest:weekly').collect(&:user).collect(&:email) # exclude anyone who uses weekly digests
recipients -= UserTag.where(value: 'digest:daily').collect(&:user).collect(&:email) # exclude anyone who uses daily digests
recipients -= UserTag.where(value: 'notifications:noemail').collect(&:user).collect(&:email) # exclude anyone who doesn't want email notifications for topics they follow

Then we'd need to modify the tests to ensure this is working!

And here's a good guide to the UI changes that'd have to happen, based on the last time we added settings to this page!

https://github.com/publiclab/plots2/pull/6105/files

Text edit suggestions:

Email Notifications
I want to receive an email:

  • Whenever there are new posts on topics I follow
  • In a daily digest
  • In a weekly digest
  • Never

I want to be notified by email for:

  • Likes on my posts
  • Comments on my posts
  • Comments on posts I鈥檝e commented on
  • Comments on posts I've liked

Browser Notifications
I want to receive browser notifications:

  • When I鈥檓 mentioned
  • When someone likes my work
  • Never

OK awesome; the only thing is that "Never" wouldn't be an option that can have an "on/off" status, so I think for now we'll leave that off? If you'd like we can follow up with something where you click that and it automatically turns off the others, but it's a little more involved. Thanks!

Regarding the "never" option, while the text Stevie suggested may not work for "never" in that way, does the graphic she drew up work?

Yes, but ONLY for the first "All topics" row, so for now we will probably keep the page layout as it is.

If in the future we set out to do a per-topic notifications settings system, we could adopt the table style view. Thanks!

Is this otherwise ready to go? Thanks!

Noting this is ready pending @publiclab/community-reps 馃憤 to be taken up; it will be very similar to #6282, which was fixed by #7183 and #7191. Thanks!

@jywarren Hey! I am an Outreachy applicant. I would like to work on this, can you help me get started on this issue?

Yes, speaking as a @publiclab/community-reps, this is ready to go 馃憤.

I believe this is complete!

image

The only thing we could consider re-opening this for is to reorganize this into radio buttons (i.e. choose between them, rather than toggle each one on or off):

image

And to add an extra option for "NEVER". However that would involve the ability to add the tag notifications:noemail which as of https://github.com/publiclab/plots2/pull/9269/ is evolving into a blanket policy of no emails (but is not there yet).

Closing but we can re-open a narrower project!

Thank you! /Settings is looking really great and fresh.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grvsachdeva picture grvsachdeva  路  3Comments

first-timers[bot] picture first-timers[bot]  路  3Comments

keshavsethi picture keshavsethi  路  3Comments

shapironick picture shapironick  路  3Comments

jywarren picture jywarren  路  3Comments