Loading Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * Make script/server work on readonly filesystems [#7719](https://github.com/diaspora/diaspora/pull/7719) ## Bug fixes * Prevent duplicate mention notifications when the post is received twice [#7721](https://github.com/diaspora/diaspora/pull/7721) ## Features * Add basic html5 audio/video embedding support [#6418](https://github.com/diaspora/diaspora/pull/6418) Loading app/models/notifications/mentioned.rb +4 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,10 @@ module Notifications ) relevant_mentions.each do |mention| create_notification(mention.person.owner, mention, actor).try(:email_the_user, mention, actor) recipient = mention.person.owner unless exists?(recipient: recipient, target: mention) create_notification(recipient, mention, actor).try(:email_the_user, mention, actor) end end end end Loading spec/models/notifications/mentioned_spec.rb +12 −0 Original line number Diff line number Diff line Loading @@ -51,5 +51,17 @@ describe Notifications::Mentioned do expect(TestNotification).not_to receive(:create_notification) TestNotification.notify(status_message, nil) end it "doesn't create notification if it already exists" do status_message = FactoryGirl.create(:status_message, text: text_mentioning(alice), author: eve.person) TestNotification.create( recipient: alice, target: Mention.where(mentions_container: status_message, person: alice.person_id).first, actors: [status_message.author] ) expect(TestNotification).not_to receive(:create_notification) TestNotification.notify(status_message, nil) end end end Loading
Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * Make script/server work on readonly filesystems [#7719](https://github.com/diaspora/diaspora/pull/7719) ## Bug fixes * Prevent duplicate mention notifications when the post is received twice [#7721](https://github.com/diaspora/diaspora/pull/7721) ## Features * Add basic html5 audio/video embedding support [#6418](https://github.com/diaspora/diaspora/pull/6418) Loading
app/models/notifications/mentioned.rb +4 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,10 @@ module Notifications ) relevant_mentions.each do |mention| create_notification(mention.person.owner, mention, actor).try(:email_the_user, mention, actor) recipient = mention.person.owner unless exists?(recipient: recipient, target: mention) create_notification(recipient, mention, actor).try(:email_the_user, mention, actor) end end end end Loading
spec/models/notifications/mentioned_spec.rb +12 −0 Original line number Diff line number Diff line Loading @@ -51,5 +51,17 @@ describe Notifications::Mentioned do expect(TestNotification).not_to receive(:create_notification) TestNotification.notify(status_message, nil) end it "doesn't create notification if it already exists" do status_message = FactoryGirl.create(:status_message, text: text_mentioning(alice), author: eve.person) TestNotification.create( recipient: alice, target: Mention.where(mentions_container: status_message, person: alice.person_id).first, actors: [status_message.author] ) expect(TestNotification).not_to receive(:create_notification) TestNotification.notify(status_message, nil) end end end