Merge branch 'stable' into develop
This commit is contained in:
commit
800be9b2cf
2 changed files with 6 additions and 1 deletions
|
|
@ -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
|
||||||
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 = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue