0
0
Fork 0

Fix featured tags for remote accounts not being kept up to date (#33372)

This commit is contained in:
Claire 2024-12-20 12:50:31 +01:00 committed by GitHub
parent d31d988e24
commit 344e2903b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 147 additions and 24 deletions

View file

@ -53,6 +53,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
ApplicationRecord.transaction do
@status = Status.create!(@params)
attach_tags(@status)
attach_mentions(@status)
attach_counts(@status)
end
@ -161,6 +162,15 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
# not a big deal
Trends.tags.register(status)
# Update featured tags
return if @tags.empty? || !status.distributable?
@account.featured_tags.where(tag_id: @tags.pluck(:id)).find_each do |featured_tag|
featured_tag.increment(status.created_at)
end
end
def attach_mentions(status)
@mentions.each do |mention|
mention.status = status
mention.save