Skip to content
Extraits de code Groupes Projets
Valider 26d0c81d rédigé par Lukas Matt's avatar Lukas Matt
Parcourir les fichiers

Added the ability to disable report-email-notification

Podmin can see a extra checkbox in Settings > Account
for disabling report-email-notification
parent 719edcd1
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -179,6 +179,7 @@ class UsersController < ApplicationController
:remember_me,
:getting_started,
email_preferences: [
:someone_reported,
:also_commented,
:mentioned,
:comment_on_post,
......
......@@ -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
......
......@@ -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",
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter