diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 886b905b1..b893621c5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -179,6 +179,7 @@ class UsersController < ApplicationController :remember_me, :getting_started, email_preferences: [ + :someone_reported, :also_commented, :mentioned, :comment_on_post, diff --git a/app/mailers/report_mailer.rb b/app/mailers/report_mailer.rb index 70a4b6e53..a9223c752 100644 --- a/app/mailers/report_mailer.rb +++ b/app/mailers/report_mailer.rb @@ -9,8 +9,11 @@ class ReportMailer < ActionMailer::Base :id => id } Role.admins.each do |role| - resource[:email] = User.find_by_id(role.person_id).email - format(resource).deliver + user = User.find_by_id(role.person_id) + if !user.user_preferences.exists?(:email_type => :someone_reported) + resource[:email] = user.email + format(resource).deliver + end end end diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index cf73c7d58..354a48400 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -4,7 +4,8 @@ class UserPreference < ActiveRecord::Base validate :must_be_valid_email_type VALID_EMAIL_TYPES = - ["mentioned", + ["someone_reported", + "mentioned", "comment_on_post", "private_message", "started_sharing", diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 88458c021..55af40b83 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -125,11 +125,22 @@ = f.fields_for :email_preferences do |type| #email_prefs + - if current_user.admin? + %p.checkbox_select + = type.label :someone_reported, t('.someone_reported') + = type.check_box :someone_reported, {:checked => @email_prefs['someone_reported']}, false, true + + %br %p.checkbox_select = type.label :started_sharing, t('.started_sharing') = type.check_box :started_sharing, {:checked => @email_prefs['started_sharing']}, false, true %br + %p.checkbox_select + = type.label :also_commented, t('.also_commented') + = type.check_box :also_commented, {:checked => @email_prefs['also_commented']}, false, true + %br + %p.checkbox_select = type.label :mentioned, t('.mentioned') = type.check_box :mentioned, {:checked => @email_prefs['mentioned']}, false, true diff --git a/app/views/users/edit.mobile.haml b/app/views/users/edit.mobile.haml index a08170ed5..a1bbc08d6 100644 --- a/app/views/users/edit.mobile.haml +++ b/app/views/users/edit.mobile.haml @@ -113,14 +113,25 @@ = f.fields_for :email_preferences do |type| #email_prefs + - if current_user.admin? + %p.checkbox_select + = type.label :someone_reported, t('.someone_reported') + = type.check_box :someone_reported, {:checked => @email_prefs['someone_reported']}, false, true + + %br %p.checkbox_select = type.label :started_sharing, t('.started_sharing') = type.check_box :started_sharing, {:checked => @email_prefs['started_sharing']}, false, true %br %p.checkbox_select - = type.label :mentioned, t('.mentioned') - = type.check_box :mentioned, {:checked => @email_prefs['mentioned']}, false, true + = type.label :also_commented, t('.also_commented') + = type.check_box :also_commented, {:checked => @email_prefs['also_commented']}, false, true + %br + + %p.checkbox_select + = type.label :mentioned, t('.mentioned') + = type.check_box :mentioned, {:checked => @email_prefs['mentioned']}, false, true %br %p.checkbox_select diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index e5a440f76..7b8ac5e08 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -1221,6 +1221,7 @@ en: edit_account: "Edit account" receive_email_notifications: "Receive email notifications when:" started_sharing: "someone starts sharing with you" + someone_reported: "someone sent a report" mentioned: "you are mentioned in a post" liked: "someone likes your post" reshared: "someone reshares your post"