Add removing referred status count
This commit is contained in:
parent
801d17f34d
commit
3cb89c592f
1 changed files with 7 additions and 0 deletions
|
@ -45,6 +45,7 @@ class RemoveStatusService < BaseService
|
||||||
remove_from_public
|
remove_from_public
|
||||||
remove_from_media if @status.with_media?
|
remove_from_media if @status.with_media?
|
||||||
remove_media
|
remove_media
|
||||||
|
decrement_references
|
||||||
end
|
end
|
||||||
|
|
||||||
@status.destroy! if permanently?
|
@status.destroy! if permanently?
|
||||||
|
@ -117,6 +118,12 @@ class RemoveStatusService < BaseService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def decrement_references
|
||||||
|
@status.references.each do |ref|
|
||||||
|
ref.decrement_count!(:status_referred_by_count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def remove_from_hashtags
|
def remove_from_hashtags
|
||||||
@account.featured_tags.where(tag_id: @status.tags.map(&:id)).each do |featured_tag|
|
@account.featured_tags.where(tag_id: @status.tags.map(&:id)).each do |featured_tag|
|
||||||
featured_tag.decrement(@status.id)
|
featured_tag.decrement(@status.id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue