mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: bulk remove tags (#10831)
https://meta.discourse.org/t/bulk-actions-remove-tags-in-addition-to-change-tags/52145
This commit is contained in:
@@ -13,7 +13,8 @@ class TopicsBulkAction
|
||||
def self.operations
|
||||
@operations ||= %w(change_category close archive change_notification_level
|
||||
reset_read dismiss_posts delete unlist archive_messages
|
||||
move_messages_to_inbox change_tags append_tags relist)
|
||||
move_messages_to_inbox change_tags append_tags remove_tags
|
||||
relist)
|
||||
end
|
||||
|
||||
def self.register_operation(name, &block)
|
||||
@@ -176,6 +177,15 @@ class TopicsBulkAction
|
||||
end
|
||||
end
|
||||
|
||||
def remove_tags
|
||||
topics.each do |t|
|
||||
if guardian.can_edit?(t)
|
||||
TopicTag.where(topic_id: t.id).delete_all
|
||||
@changed_ids << t.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def guardian
|
||||
@guardian ||= Guardian.new(@user)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user