Loading Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,7 @@ The command will report queues that still have jobs and launch sidekiq process f * Make screenreaders read alerts [#6973](https://github.com/diaspora/diaspora/pull/6973) * Display message when there are no posts in a stream [#6974](https://github.com/diaspora/diaspora/pull/6974) * Add bootstrap-markdown editor to the publisher [#6551](https://github.com/diaspora/diaspora/pull/6551) * Don't create notifications for ignored users [#6984](https://github.com/diaspora/diaspora/pull/6984) # 0.5.10.2 Loading app/models/contact.rb +3 −2 Original line number Diff line number Diff line Loading @@ -118,7 +118,8 @@ class Contact < ActiveRecord::Base end def not_blocked_user errors.add(:base, "Cannot connect to an ignored user") if user && user.blocks.where(person_id: person_id).exists? if receiving && user && user.blocks.where(person_id: person_id).exists? errors.add(:base, "Cannot connect to an ignored user") end end end app/models/notification.rb +7 −5 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class Notification < ActiveRecord::Base end def self.concatenate_or_create(recipient, target, actor) return nil if suppress_notification?(recipient, target) return nil if suppress_notification?(recipient, actor) find_or_initialize_by(recipient: recipient, target: target, unread: true).tap do |notification| notification.actors |= [actor] Loading @@ -42,12 +42,14 @@ class Notification < ActiveRecord::Base end end def self.create_notification(recipient_id, target, actor) create(recipient_id: recipient_id, target: target, actors: [actor]) def self.create_notification(recipient, target, actor) return nil if suppress_notification?(recipient, actor) create(recipient: recipient, target: target, actors: [actor]) end private_class_method def self.suppress_notification?(recipient, post) post.is_a?(Post) && recipient.is_shareable_hidden?(post) private_class_method def self.suppress_notification?(recipient, actor) recipient.blocks.where(person: actor).exists? end def self.types Loading app/models/notifications/also_commented.rb +3 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,9 @@ module Notifications recipient_ids = commentable.participants.local.where.not(id: [commentable.author_id, actor.id]).pluck(:owner_id) User.where(id: recipient_ids).find_each do |recipient| concatenate_or_create(recipient, commentable, actor) .try {|notification| notification.email_the_user(comment, actor) } next if recipient.is_shareable_hidden?(commentable) concatenate_or_create(recipient, commentable, actor).try(:email_the_user, comment, actor) end end end Loading app/models/notifications/mentioned.rb +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ module Notifications next if recipient == actor || !(mentionable.public || recipient_user_ids.include?(recipient.owner_id)) create_notification(recipient.owner_id, mention, actor).email_the_user(mention, actor) create_notification(recipient.owner, mention, actor).try(:email_the_user, mention, actor) end end end Loading Loading
Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,7 @@ The command will report queues that still have jobs and launch sidekiq process f * Make screenreaders read alerts [#6973](https://github.com/diaspora/diaspora/pull/6973) * Display message when there are no posts in a stream [#6974](https://github.com/diaspora/diaspora/pull/6974) * Add bootstrap-markdown editor to the publisher [#6551](https://github.com/diaspora/diaspora/pull/6551) * Don't create notifications for ignored users [#6984](https://github.com/diaspora/diaspora/pull/6984) # 0.5.10.2 Loading
app/models/contact.rb +3 −2 Original line number Diff line number Diff line Loading @@ -118,7 +118,8 @@ class Contact < ActiveRecord::Base end def not_blocked_user errors.add(:base, "Cannot connect to an ignored user") if user && user.blocks.where(person_id: person_id).exists? if receiving && user && user.blocks.where(person_id: person_id).exists? errors.add(:base, "Cannot connect to an ignored user") end end end
app/models/notification.rb +7 −5 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class Notification < ActiveRecord::Base end def self.concatenate_or_create(recipient, target, actor) return nil if suppress_notification?(recipient, target) return nil if suppress_notification?(recipient, actor) find_or_initialize_by(recipient: recipient, target: target, unread: true).tap do |notification| notification.actors |= [actor] Loading @@ -42,12 +42,14 @@ class Notification < ActiveRecord::Base end end def self.create_notification(recipient_id, target, actor) create(recipient_id: recipient_id, target: target, actors: [actor]) def self.create_notification(recipient, target, actor) return nil if suppress_notification?(recipient, actor) create(recipient: recipient, target: target, actors: [actor]) end private_class_method def self.suppress_notification?(recipient, post) post.is_a?(Post) && recipient.is_shareable_hidden?(post) private_class_method def self.suppress_notification?(recipient, actor) recipient.blocks.where(person: actor).exists? end def self.types Loading
app/models/notifications/also_commented.rb +3 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,9 @@ module Notifications recipient_ids = commentable.participants.local.where.not(id: [commentable.author_id, actor.id]).pluck(:owner_id) User.where(id: recipient_ids).find_each do |recipient| concatenate_or_create(recipient, commentable, actor) .try {|notification| notification.email_the_user(comment, actor) } next if recipient.is_shareable_hidden?(commentable) concatenate_or_create(recipient, commentable, actor).try(:email_the_user, comment, actor) end end end Loading
app/models/notifications/mentioned.rb +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ module Notifications next if recipient == actor || !(mentionable.public || recipient_user_ids.include?(recipient.owner_id)) create_notification(recipient.owner_id, mention, actor).email_the_user(mention, actor) create_notification(recipient.owner, mention, actor).try(:email_the_user, mention, actor) end end end Loading