Add notifications when a reblogged status has been updated (#17404)
* Add notifications when a reblogged status has been updated * Change wording to say "edit" instead of "update" and add missing controls * Replace previous update notifications with the most up-to-date one
This commit is contained in:
parent
d0fcf07436
commit
8f03b7a2fb
14 changed files with 103 additions and 8 deletions
|
@ -35,6 +35,7 @@ class Notification < ApplicationRecord
|
|||
follow_request
|
||||
favourite
|
||||
poll
|
||||
update
|
||||
).freeze
|
||||
|
||||
TARGET_STATUS_INCLUDES_BY_TYPE = {
|
||||
|
@ -43,6 +44,7 @@ class Notification < ApplicationRecord
|
|||
mention: [mention: :status],
|
||||
favourite: [favourite: :status],
|
||||
poll: [poll: :status],
|
||||
update: :status,
|
||||
}.freeze
|
||||
|
||||
belongs_to :account, optional: true
|
||||
|
@ -76,7 +78,7 @@ class Notification < ApplicationRecord
|
|||
|
||||
def target_status
|
||||
case type
|
||||
when :status
|
||||
when :status, :update
|
||||
status
|
||||
when :reblog
|
||||
status&.reblog
|
||||
|
@ -110,7 +112,7 @@ class Notification < ApplicationRecord
|
|||
cached_status = cached_statuses_by_id[notification.target_status.id]
|
||||
|
||||
case notification.type
|
||||
when :status
|
||||
when :status, :update
|
||||
notification.status = cached_status
|
||||
when :reblog
|
||||
notification.status.reblog = cached_status
|
||||
|
|
|
@ -62,6 +62,7 @@ class Status < ApplicationRecord
|
|||
has_many :favourites, inverse_of: :status, dependent: :destroy
|
||||
has_many :bookmarks, inverse_of: :status, dependent: :destroy
|
||||
has_many :reblogs, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblog, dependent: :destroy
|
||||
has_many :reblogged_by_accounts, through: :reblogs, class_name: 'Account', source: :account
|
||||
has_many :replies, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :thread
|
||||
has_many :mentions, dependent: :destroy, inverse_of: :status
|
||||
has_many :active_mentions, -> { active }, class_name: 'Mention', inverse_of: :status
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue