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,21 +206,29 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
||||||
|
|
||||||
added_tags = current_tags - previous_tags
|
added_tags = current_tags - previous_tags
|
||||||
|
|
||||||
unless added_tags.empty?
|
increment_featured_tags(added_tags) unless added_tags.empty?
|
||||||
@account.featured_tags.where(tag_id: added_tags.pluck(:id)).find_each do |featured_tag|
|
|
||||||
featured_tag.increment(@status.created_at)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
removed_tags = previous_tags - current_tags
|
removed_tags = previous_tags - current_tags
|
||||||
|
|
||||||
unless removed_tags.empty?
|
decrement_featured_tags(removed_tags) unless removed_tags.empty?
|
||||||
@account.featured_tags.where(tag_id: removed_tags.pluck(:id)).find_each do |featured_tag|
|
end
|
||||||
featured_tag.decrement(@status)
|
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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!
|
def update_mentions!
|
||||||
unresolved_mentions = []
|
unresolved_mentions = []
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user