mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-26 04:02:42 +00:00
Add quoted_update notification type (#35820)
This commit is contained in:
parent
7aba79ade9
commit
f3a932d8a1
12 changed files with 117 additions and 6 deletions
|
|
@ -77,6 +77,9 @@ class Notification < ApplicationRecord
|
|||
quote: {
|
||||
filterable: true,
|
||||
}.freeze,
|
||||
quoted_update: {
|
||||
filterable: false,
|
||||
}.freeze,
|
||||
}.freeze
|
||||
|
||||
TYPES = PROPERTIES.keys.freeze
|
||||
|
|
@ -89,6 +92,7 @@ class Notification < ApplicationRecord
|
|||
favourite: [favourite: :status],
|
||||
poll: [poll: :status],
|
||||
update: :status,
|
||||
quoted_update: :status,
|
||||
'admin.report': [report: :target_account],
|
||||
}.freeze
|
||||
|
||||
|
|
@ -120,7 +124,7 @@ class Notification < ApplicationRecord
|
|||
|
||||
def target_status
|
||||
case type
|
||||
when :status, :update
|
||||
when :status, :update, :quoted_update
|
||||
status
|
||||
when :reblog
|
||||
status&.reblog
|
||||
|
|
@ -172,7 +176,7 @@ class Notification < ApplicationRecord
|
|||
cached_status = cached_statuses_by_id[notification.target_status.id]
|
||||
|
||||
case notification.type
|
||||
when :status, :update
|
||||
when :status, :update, :quoted_update
|
||||
notification.status = cached_status
|
||||
when :reblog
|
||||
notification.status.reblog = cached_status
|
||||
|
|
@ -202,7 +206,9 @@ class Notification < ApplicationRecord
|
|||
return unless new_record?
|
||||
|
||||
case activity_type
|
||||
when 'Status', 'Follow', 'Favourite', 'FollowRequest', 'Poll', 'Report', 'Quote'
|
||||
when 'Status'
|
||||
self.from_account_id = type == :quoted_update ? activity&.quote&.quoted_account_id : activity&.account_id
|
||||
when 'Follow', 'Favourite', 'FollowRequest', 'Poll', 'Report', 'Quote'
|
||||
self.from_account_id = activity&.account_id
|
||||
when 'Mention'
|
||||
self.from_account_id = activity&.status&.account_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue