Skip to content
Extraits de code Groupes Projets
Valider 00588e1e rédigé par cmrd Senya's avatar cmrd Senya Validation de Jonne Haß
Parcourir les fichiers

Disable self-notification possibility

closes #6512
parent d8ed529f
Branches
Étiquettes
Aucune requête de fusion associée trouvée
...@@ -15,7 +15,7 @@ class Notification < ActiveRecord::Base ...@@ -15,7 +15,7 @@ class Notification < ActiveRecord::Base
end end
def self.notify(recipient, target, actor) def self.notify(recipient, target, actor)
return nil unless target.respond_to? :notification_type return nil unless target.respond_to?(:notification_type) && recipient.person != actor
note_type = target.notification_type(recipient, actor) note_type = target.notification_type(recipient, actor)
return nil unless note_type return nil unless note_type
......
...@@ -73,6 +73,11 @@ describe Notification, :type => :model do ...@@ -73,6 +73,11 @@ describe Notification, :type => :model do
Notification.notify(@user, @request, @person) Notification.notify(@user, @request, @person)
end end
it "does nothing if told to notify oneself" do
notification = Notification.notify(@user, @request, @user.person)
expect(notification).to eq(nil)
end
describe '#emails_the_user' do describe '#emails_the_user' do
it 'calls mail' do it 'calls mail' do
opts = { opts = {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter