FIX: do not show "move to new PM" option to moderators

This commit is contained in:
Arpit Jalan 2019-02-18 11:34:29 +05:30
parent 052eaed16a
commit dc2776bcdd
2 changed files with 13 additions and 9 deletions

View File

@ -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 => {

View File

@ -2,7 +2,7 @@
{{#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>
@ -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>