Eliminate duplication and provide status notifications outside of feed to home
This commit is contained in:
parent
96258f2a86
commit
2f88e910b6
2 changed files with 2 additions and 1 deletions
|
@ -57,6 +57,7 @@ class Notification < ApplicationRecord
|
||||||
belongs_to :poll, foreign_key: 'activity_id', optional: true
|
belongs_to :poll, foreign_key: 'activity_id', optional: true
|
||||||
|
|
||||||
validates :type, inclusion: { in: TYPES }
|
validates :type, inclusion: { in: TYPES }
|
||||||
|
validates :activity_id, uniqueness: { scope: [:account_id, :type] }, if: -> { type.to_sym == :status }
|
||||||
|
|
||||||
scope :without_suspended, -> { joins(:from_account).merge(Account.without_suspended) }
|
scope :without_suspended, -> { joins(:from_account).merge(Account.without_suspended) }
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class FeedInsertWorker
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify?
|
def notify?
|
||||||
return false if @type != :home || @status.reblog? || (@status.reply? && @status.in_reply_to_account_id != @status.account_id)
|
return false if @status.reblog? || (@status.reply? && @status.in_reply_to_account_id != @status.account_id)
|
||||||
|
|
||||||
Follow.find_by(account: @follower, target_account: @status.account)&.notify?
|
Follow.find_by(account: @follower, target_account: @status.account)&.notify?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue