mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 17:31:12 +00:00
Merge d66c922b6e
into 14cb5ff881
This commit is contained in:
commit
4897e0bc4b
|
@ -206,19 +206,27 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
|
||||
added_tags = current_tags - previous_tags
|
||||
|
||||
unless added_tags.empty?
|
||||
@account.featured_tags.where(tag_id: added_tags.pluck(:id)).find_each do |featured_tag|
|
||||
increment_featured_tags(added_tags) unless added_tags.empty?
|
||||
|
||||
removed_tags = previous_tags - current_tags
|
||||
|
||||
decrement_featured_tags(removed_tags) unless removed_tags.empty?
|
||||
end
|
||||
|
||||
def increment_featured_tags(added_tags)
|
||||
featured_tags_for(added_tags).find_each do |featured_tag|
|
||||
featured_tag.increment(@status.created_at)
|
||||
end
|
||||
end
|
||||
|
||||
removed_tags = previous_tags - current_tags
|
||||
|
||||
unless removed_tags.empty?
|
||||
@account.featured_tags.where(tag_id: removed_tags.pluck(:id)).find_each do |featured_tag|
|
||||
def decrement_featured_tags(removed_tags)
|
||||
featured_tags_for(removed_tags).find_each do |featured_tag|
|
||||
featured_tag.decrement(@status)
|
||||
end
|
||||
end
|
||||
|
||||
def featured_tags_for(tags)
|
||||
@account.featured_tags.where(tag_id: tags.pluck(:id))
|
||||
end
|
||||
|
||||
def update_mentions!
|
||||
|
|
Loading…
Reference in New Issue
Block a user