Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out moderators who've checked "Do you want to be notified by a email for moderation emails?" in /settings #9114

Closed
jywarren opened this issue Feb 2, 2021 · 2 comments · Fixed by #9269
Labels
fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute

Comments

@jywarren
Copy link
Member

jywarren commented Feb 2, 2021

Looks like we missed a couple email notifications in #6282 -- easy fix though!

Any line which collects moderator emails in this file (and elsewhere) we should go through and filter out any one which has a tag opting out of moderator email notifications!

Those are the ones which have a tag like notifications:noemail or no-moderation-emails (confirmed this toggle works!)

That said, we have a setting in /settings for this:

<span>Do you want to be notified by a email for moderation emails? </span>
<span>
<label class="switch">
<p> Notification switch </p>
<input type="checkbox" name="no-moderation-emails" <% unless UserTag.exists?(current_user.id, 'no-moderation-emails') %>checked<% end %>>

image

So let's filter for at least no-moderation-emails and then maybe also notifications:noemail when collecting emails on these lines:

moderators = User.where(role: %w(moderator admin)).collect(&:email)

Here's a code example for how this works:

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

    all_moderators = User.where(role: %w(moderator admin))
    moderators = []
    all_moderators.each do |mod_user|
      moderators << mod_user.email unless mod_user.has_tag('no-moderation-emails')
    end

cc #6867 #6282

@jywarren jywarren added fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute labels Mar 2, 2021
@17sushmita
Copy link
Member

Hi @jywarren , Can I work on this issue.

@cesswairimu
Copy link
Collaborator

Go ahead @17sushmita . Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants