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.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb
index f250e5cb0..05586aa1b 100644
--- a/app/services/update_status_service.rb
+++ b/app/services/update_status_service.rb
@@ -39,10 +39,9 @@ class UpdateStatusService < BaseService
     (@params[:edited]     ||= 1 + @status.edited) if @params[:published].presence || @status.published?
 
     update_tags if @status.local?
-    filter_tags
 
     @delete_payload         = Oj.dump(event: :delete, payload: @status.id.to_s)
-    @deleted_tag_ids        = @status.tag_ids - @tags.pluck(:id)
+    @deleted_tag_ids        = @status.tags.pluck(:id) - @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) || [])
 
@@ -80,7 +79,7 @@ class UpdateStatusService < BaseService
   end
 
   def detach_deleted_tags
-    @status.tags.where(id: @deleted_tag_ids).destroy_all if @deleted_tag_ids.present?
+    @status.tags -= Tag.where(id: @deleted_tag_ids) if @deleted_tag_ids.present?
   end
 
   def prune_tags
@@ -107,10 +106,6 @@ class UpdateStatusService < BaseService
     @tags |= @status.tags.where.not(id: old_explicit_tags.select(:id))
   end
 
-  def filter_tags
-    @tags.select! { |tag| tag =~ /\A(#{Tag::HASHTAG_NAME_RE})\z/i }
-  end
-
   def update_mentions
     @new_mention_ids = @mentions.pluck(:id) - @status.mention_ids
     @status.text, @mentions = ResolveMentionsService.new.call(@status, mentions: @mentions)