Fix unable to removing references
This commit is contained in:
parent
7026a250b2
commit
fb9dbfc866
1 changed files with 3 additions and 0 deletions
|
@ -68,6 +68,8 @@ class ProcessReferencesService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_notifications!
|
def create_notifications!
|
||||||
|
return if @added_objects.blank?
|
||||||
|
|
||||||
local_reference_objects = @added_objects.filter { |ref| ref.target_status.account.local? }
|
local_reference_objects = @added_objects.filter { |ref| ref.target_status.account.local? }
|
||||||
return if local_reference_objects.empty?
|
return if local_reference_objects.empty?
|
||||||
|
|
||||||
|
@ -80,6 +82,7 @@ class ProcessReferencesService < BaseService
|
||||||
return if removed_references.empty?
|
return if removed_references.empty?
|
||||||
|
|
||||||
statuses = Status.where(id: removed_references)
|
statuses = Status.where(id: removed_references)
|
||||||
|
|
||||||
@status.reference_objects.where(target_status: statuses).destroy_all
|
@status.reference_objects.where(target_status: statuses).destroy_all
|
||||||
statuses.each do |status|
|
statuses.each do |status|
|
||||||
status.decrement_count!(:status_referred_by_count)
|
status.decrement_count!(:status_referred_by_count)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue