Fix featured tags for remote accounts not being kept up to date (#33372)
This commit is contained in:
		@@ -186,7 +186,26 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def update_tags!
 | 
			
		||||
    @status.tags = Tag.find_or_create_by_names(@raw_tags)
 | 
			
		||||
    previous_tags = @status.tags.to_a
 | 
			
		||||
    current_tags = @status.tags = Tag.find_or_create_by_names(@raw_tags)
 | 
			
		||||
 | 
			
		||||
    return unless @status.distributable?
 | 
			
		||||
 | 
			
		||||
    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|
 | 
			
		||||
        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|
 | 
			
		||||
        featured_tag.decrement(@status)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def update_mentions!
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user