A platform for community discussion. Free, open, simple.
FIX: do not show "move to new PM" option to moderators
Arpit Jalandc2776bcddc0
diff --git a/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6 b/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6index 5e47258f7cf..9ca1b990df8 100644--- a/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6+++ b/app/assets/javascripts/discourse/controllers/move-to-topic.js.es6@@ -66,10 +66,9 @@ export default Ember.Controller.extend(ModalFunctionality, {});const isPrivateMessage = this.get("model.isPrivateMessage");- const canSplitTopic = this.get("canSplitTopic");if (isPrivateMessage) {- this.set("selection", canSplitTopic ? "new_message" : "existing_message");- } else if (!canSplitTopic) {+ this.set("selection", this.get("canSplitToPM") ? "new_message" : "existing_message");+ } else if (!this.get("canSplitTopic")) {this.set("selection", "existing_topic");Ember.run.next(() => $("#choose-topic-title").focus());}@@ -85,6 +84,11 @@ export default Ember.Controller.extend(ModalFunctionality, {);},+ @computed("canSplitTopic")+ canSplitToPM(canSplitTopic) {+ return canSplitTopic && (this.currentUser && this.currentUser.admin);+ },+actions: {performMove() {this.get("moveTypes").forEach(type => {diff --git a/app/assets/javascripts/discourse/templates/modal/move-to-topic.hbs b/app/assets/javascripts/discourse/templates/modal/move-to-topic.hbsindex e268806e9b7..3a0335af40f 100644--- a/app/assets/javascripts/discourse/templates/modal/move-to-topic.hbs+++ b/app/assets/javascripts/discourse/templates/modal/move-to-topic.hbs@@ -2,17 +2,17 @@{{#if model.isPrivateMessage}}<div class="radios">- {{#if canSplitTopic}}+ {{#if canSplitToPM}}<label class="radio-label" for="move-to-new-message">{{radio-button id='move-to-new-message' name="move-to-entity" value="new_message" selection=selection}}<b>{{i18n 'topic.move_to_new_message.radio_label'}}</b></label>{{/if}}- <label class="radio-label" for="move-to-existing-message">- {{radio-button id='move-to-existing-message' name="move-to-entity" value="existing_message" selection=selection}}- <b>{{i18n 'topic.move_to_existing_message.radio_label'}}</b>- </label>+ <label class="radio-label" for="move-to-existing-message">+ {{radio-button id='move-to-existing-message' name="move-to-entity" value="existing_message" selection=selection}}+ <b>{{i18n 'topic.move_to_existing_message.radio_label'}}</b>+ </label></div>{{#if canSplitTopic}}@@ -55,7 +55,7 @@<b>{{i18n 'topic.merge_topic.radio_label'}}</b></label>- {{#if canSplitTopic}}+ {{#if canSplitToPM}}<label class="radio-label" for="move-to-new-message">{{radio-button id='move-to-new-message' name="move-to-entity" value="new_message" selection=selection}}<b>{{i18n 'topic.move_to_new_message.radio_label'}}</b>