about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/services/update_status_service.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb
index 887384991..f250e5cb0 100644
--- a/app/services/update_status_service.rb
+++ b/app/services/update_status_service.rb
@@ -40,15 +40,12 @@ class UpdateStatusService < BaseService
 
     update_tags if @status.local?
     filter_tags
-    update_mentions
 
     @delete_payload         = Oj.dump(event: :delete, payload: @status.id.to_s)
     @deleted_tag_ids        = @status.tag_ids - @tags.pluck(:id)
     @deleted_tag_names      = @status.tags.pluck(:name) - @tags.pluck(:name)
     @deleted_attachment_ids = @status.media_attachment_ids - (@params[:media_attachment_ids] || @params[:media_attachments]&.pluck(:id) || [])
 
-    @new_mention_ids = @mentions.pluck(:id) - @status.mention_ids
-
     ApplicationRecord.transaction do
       @status.update!(@params)
 
@@ -56,9 +53,11 @@ class UpdateStatusService < BaseService
         ProcessCommandTagsService.new.call(@account, @status)
       else
         process_inline_images!
-        @status.save!
       end
 
+      update_mentions
+      @status.save!
+
       detach_deleted_tags
       attach_updated_tags
     end
@@ -113,7 +112,9 @@ class UpdateStatusService < BaseService
   end
 
   def update_mentions
-    @params[:text], @mentions = ResolveMentionsService.new.call(@status, text: @params[:text], mentions: @mentions)
+    @new_mention_ids = @mentions.pluck(:id) - @status.mention_ids
+    @status.text, @mentions = ResolveMentionsService.new.call(@status, mentions: @mentions)
+    @new_mention_ids |= (@mentions.pluck(:id) - @new_mention_ids)
   end
 
   def attach_updated_tags