FEATURE: move a topic from PM to regular topic or vice versa
This commit is contained in:
@@ -545,6 +545,14 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||
changePostOwner(post) {
|
||||
this.get('selectedPosts').addObject(post);
|
||||
this.send('changeOwner');
|
||||
},
|
||||
|
||||
convertToPublicTopic() {
|
||||
this.get('content').convertTopic("public");
|
||||
},
|
||||
|
||||
convertToPrivateMessage() {
|
||||
this.get('content').convertTopic("private");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { propertyEqual } from 'discourse/lib/computed';
|
||||
import { longDate } from 'discourse/lib/formatter';
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
import ActionSummary from 'discourse/models/action-summary';
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
|
||||
export function loadTopicView(topic, args) {
|
||||
const topicId = topic.get('id');
|
||||
@@ -446,8 +447,13 @@ const Topic = RestModel.extend({
|
||||
}).finally(()=>this.set('archiving', false));
|
||||
|
||||
return promise;
|
||||
}
|
||||
},
|
||||
|
||||
convertTopic(type) {
|
||||
return Discourse.ajax(`/t/${this.get('id')}/convert-topic/${type}`, {type: 'PUT'}).then(() => {
|
||||
window.location.reload();
|
||||
}).catch(popupAjaxError);
|
||||
}
|
||||
});
|
||||
|
||||
Topic.reopenClass({
|
||||
|
||||
@@ -256,6 +256,16 @@
|
||||
{{/if}}
|
||||
</li>
|
||||
|
||||
{{#if currentUser.admin}}
|
||||
<li class="topic-admin-convert">
|
||||
{{#if model.isPrivateMessage}}
|
||||
{{d-button action="convertToPublicTopic" icon="comment" label="topic.actions.make_public"}}
|
||||
{{else}}
|
||||
{{d-button action="convertToPrivateMessage" icon="envelope" label="topic.actions.make_private"}}
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet "topic-admin-menu-buttons"}}
|
||||
{{/popup-menu}}
|
||||
{{/if}}
|
||||
|
||||
@@ -20,7 +20,9 @@ const icons = {
|
||||
'visible.disabled': 'eye-slash',
|
||||
'split_topic': 'sign-out',
|
||||
'invited_user': 'plus-circle',
|
||||
'removed_user': 'minus-circle'
|
||||
'removed_user': 'minus-circle',
|
||||
'public_topic': 'comment',
|
||||
'private_topic': 'envelope'
|
||||
};
|
||||
|
||||
export default createWidget('post-small-action', {
|
||||
|
||||
Reference in New Issue
Block a user