From 61447a8046b9c57b474a7973017de145615f8b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 21 Aug 2018 19:35:40 +0200 Subject: [PATCH] UX: don't show the whisper toggle when replying to a whisper --- .../discourse/controllers/composer.js.es6 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index dc298f88f42..76d604ef750 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -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" }; }) );