FEATURE: bulk relist
This commit is contained in:
parent
f7e8bc6216
commit
2f8b1e33f4
|
@ -26,6 +26,19 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
categoryId: Ember.computed.alias('model.category.id'),
|
||||
|
||||
onShow() {
|
||||
let showRelistButton = false;
|
||||
const topics = this.get('model.topics');
|
||||
for (let t = 0; t < topics.length; t++) {
|
||||
if (!topics[t].visible) {
|
||||
showRelistButton = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (showRelistButton && !_buttons[9]) {
|
||||
addBulkButton('relistTopics', 'relist_topics');
|
||||
} else if (!showRelistButton && _buttons[9]) {
|
||||
_buttons.splice(9, 1);
|
||||
}
|
||||
this.set('modal.modalClass', 'topic-bulk-actions-modal small');
|
||||
|
||||
const buttonRows = [];
|
||||
|
@ -126,6 +139,10 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
this.forEachPerformed({type: 'unlist'}, t => t.set('visible', false));
|
||||
},
|
||||
|
||||
relistTopics() {
|
||||
this.forEachPerformed({type: 'relist'}, t => t.set('visible', true));
|
||||
},
|
||||
|
||||
changeCategory() {
|
||||
const categoryId = parseInt(this.get('newCategoryId'), 10) || 0;
|
||||
const category = Discourse.Category.findById(categoryId);
|
||||
|
|
|
@ -1364,6 +1364,7 @@ en:
|
|||
select_all: "Select All"
|
||||
clear_all: "Clear All"
|
||||
unlist_topics: "Unlist Topics"
|
||||
relist_topics: "Relist Topics"
|
||||
reset_read: "Reset Read"
|
||||
delete: "Delete Topics"
|
||||
dismiss: "Dismiss"
|
||||
|
|
|
@ -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 append_tags)
|
||||
move_messages_to_inbox change_tags append_tags relist)
|
||||
end
|
||||
|
||||
def self.register_operation(name, &block)
|
||||
|
@ -115,6 +115,15 @@ class TopicsBulkAction
|
|||
end
|
||||
end
|
||||
|
||||
def relist
|
||||
topics.each do |t|
|
||||
if guardian.can_moderate?(t)
|
||||
t.update_status('visible', true, @user)
|
||||
@changed_ids << t.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def archive
|
||||
topics.each do |t|
|
||||
if guardian.can_moderate?(t)
|
||||
|
|
Loading…
Reference in New Issue