FIX: bulk change tags works with category tag settings
This commit is contained in:
parent
6e47e02738
commit
0e8808fbe8
|
@ -3,7 +3,13 @@ import showModal from 'discourse/lib/show-modal';
|
|||
export default Ember.Component.extend({
|
||||
actions: {
|
||||
showBulkActions() {
|
||||
const controller = showModal('topic-bulk-actions', { model: this.get('selected'), title: 'topics.bulk.actions' });
|
||||
const controller = showModal('topic-bulk-actions', {
|
||||
model: {
|
||||
topics: this.get('selected'),
|
||||
category: this.get('category')
|
||||
},
|
||||
title: 'topics.bulk.actions'
|
||||
});
|
||||
controller.set('refreshClosure', () => this.sendAction());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
buttonRows: null,
|
||||
|
||||
emptyTags: Ember.computed.empty('tags'),
|
||||
categoryId: Ember.computed.alias('model.category.id'),
|
||||
|
||||
onShow() {
|
||||
this.set('modal.modalClass', 'topic-bulk-actions-modal small');
|
||||
|
@ -44,8 +45,8 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
perform(operation) {
|
||||
this.set('loading', true);
|
||||
|
||||
const topics = this.get('model');
|
||||
return Discourse.Topic.bulkOperation(this.get('model'), operation).then(result => {
|
||||
const topics = this.get('model.topics');
|
||||
return Discourse.Topic.bulkOperation(topics, operation).then(result => {
|
||||
this.set('loading', false);
|
||||
if (result && result.topic_ids) {
|
||||
return result.topic_ids.map(t => topics.findBy('id', t));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<p>{{i18n "topics.bulk.choose_new_tags"}}</p>
|
||||
|
||||
<p>{{tag-chooser tags=tags}}</p>
|
||||
<p>{{tag-chooser tags=tags categoryId=categoryId}}</p>
|
||||
|
||||
{{d-button action="changeTags" disabled=emptyTags label="topics.bulk.change_tags"}}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{bulk-select-button selected=selected action="refresh"}}
|
||||
{{bulk-select-button selected=selected action="refresh" category=category}}
|
||||
|
||||
{{#discovery-topics-list model=model refresh="refresh" incomingCount=topicTrackingState.incomingCount}}
|
||||
{{#if top}}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{{#d-modal-body}}
|
||||
<p>{{{i18n 'topics.bulk.selected' count=model.length}}}</p>
|
||||
<p>{{{i18n 'topics.bulk.selected' count=model.topics.length}}}</p>
|
||||
{{outlet "bulkOutlet"}}
|
||||
{{/d-modal-body}}
|
||||
|
|
Loading…
Reference in New Issue