mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 17:31:12 +00:00
Fix Style/GuardClause
in process status update service
This commit is contained in:
parent
25f1a515f8
commit
d66c922b6e
|
@ -204,21 +204,29 @@ 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|
|
||||
featured_tag.increment(@status.created_at)
|
||||
end
|
||||
end
|
||||
increment_featured_tags(added_tags) unless added_tags.empty?
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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!
|
||||
unresolved_mentions = []
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user