FEATURE: Add Archive Topics to Bulk actions

Add the ability to archive topics in bulk
https://meta.discourse.org/t/archive-topics-via-bulk/20302
This commit is contained in:
cpradio
2014-09-22 14:56:48 -04:00
parent d97548114f
commit afdbb2bb96
5 changed files with 54 additions and 6 deletions

View File

@ -8,7 +8,7 @@ class TopicsBulkAction
end
def self.operations
%w(change_category close change_notification_level reset_read dismiss_posts delete)
%w(change_category close archive change_notification_level reset_read dismiss_posts delete)
end
def perform!
@ -61,6 +61,15 @@ class TopicsBulkAction
end
end
def archive
topics.each do |t|
if guardian.can_moderate?(t)
t.update_status('archived', true, @user)
@changed_ids << t.id
end
end
end
def delete
topics.each do |t|
t.trash! if guardian.can_delete?(t)