UX: don't show the whisper toggle when replying to a whisper

This commit is contained in:
Régis Hanol 2018-08-21 19:35:40 +02:00
parent 17dc8f2490
commit 61447a8046

View File

@ -203,15 +203,21 @@ export default Ember.Controller.extend({
canUnlistTopic: Em.computed.and("model.creatingTopic", "isStaffUser"),
@computed("model.action", "isStaffUser")
canWhisper(action, isStaffUser) {
@computed("canWhisper", "model.whisper")
showWhisperToggle(canWhisper, isWhisper) {
return canWhisper && !isWhisper;
},
@computed("isStaffUser", "model.action")
canWhisper(isStaffUser, action) {
return (
isStaffUser &&
this.siteSettings.enable_whispers &&
action === Composer.REPLY
isStaffUser &&
Composer.REPLY === action
);
},
_setupPopupMenuOption(callback) {
let option = callback();
@ -246,7 +252,7 @@ export default Ember.Controller.extend({
action: "toggleWhisper",
icon: "eye-slash",
label: "composer.toggle_whisper",
condition: "canWhisper"
condition: "showWhisperToggle"
};
})
);