mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
ADD: Append tags bulk action for topics
This commit is contained in:
@@ -11,7 +11,7 @@ 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)
|
||||
move_messages_to_inbox change_tags append_tags)
|
||||
end
|
||||
|
||||
def self.register_operation(name, &block)
|
||||
@@ -146,6 +146,20 @@ class TopicsBulkAction
|
||||
end
|
||||
end
|
||||
|
||||
def append_tags
|
||||
tags = @operation[:tags]
|
||||
tags = DiscourseTagging.tags_for_saving(tags, guardian) if tags.present?
|
||||
|
||||
topics.each do |t|
|
||||
if guardian.can_edit?(t)
|
||||
if tags.present?
|
||||
DiscourseTagging.tag_topic_by_names(t, guardian, tags, append=true)
|
||||
end
|
||||
@changed_ids << t.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def guardian
|
||||
@guardian ||= Guardian.new(@user)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user