A platform for community discussion. Free, open, simple.
FIX: makes composer-actions toggling whisper instead of replying
Joffrey JAFFEUXf7df68c9a3be
diff --git a/app/assets/javascripts/discourse/templates/components/composer-action-title.hbs b/app/assets/javascripts/discourse/templates/components/composer-action-title.hbsindex fcb2bacfa05..3688355a92c 100644--- a/app/assets/javascripts/discourse/templates/components/composer-action-title.hbs+++ b/app/assets/javascripts/discourse/templates/components/composer-action-title.hbs@@ -4,7 +4,6 @@{{composer-actionscomposerModel=modeloptions=model.replyOptions- whispering=model.whispercanWhisper=canWhisperaction=model.action}}{{/if}}diff --git a/app/assets/javascripts/select-kit/components/composer-actions.js.es6 b/app/assets/javascripts/select-kit/components/composer-actions.js.es6index 6eb218d45bd..2ca9ad99023 100644--- a/app/assets/javascripts/select-kit/components/composer-actions.js.es6+++ b/app/assets/javascripts/select-kit/components/composer-actions.js.es6@@ -28,8 +28,8 @@ export default DropdownSelectBoxComponent.extend({return content;},- @computed("options", "canWhisper", "whispering", "composerModel.post.username")- content(options, canWhisper, whispering, postUsername) {+ @computed("options", "canWhisper", "composerModel.post.username")+ content(options, canWhisper, postUsername) {let items = [{name: I18n.t("composer.composer_actions.reply_as_new_topic.label"),@@ -58,21 +58,12 @@ export default DropdownSelectBoxComponent.extend({}if (canWhisper) {- if (whispering) {- items.push({- name: I18n.t("composer.composer_actions.reply_as_not_whisper.label"),- description: I18n.t("composer.composer_actions.reply_as_not_whisper.desc"),- icon: "eye",- id: "reply_as_not_whisper"- });- } else {- items.push({- name: I18n.t("composer.composer_actions.reply_as_whisper.label"),- description: I18n.t("composer.composer_actions.reply_as_whisper.desc"),- icon: "eye-slash",- id: "reply_as_whisper"- });- }+ items.push({+ name: I18n.t("composer.composer_actions.toggle_whisper.label"),+ description: I18n.t("composer.composer_actions.toggle_whisper.desc"),+ icon: "eye-slash",+ id: "toggle_whisper"+ });}return items;@@ -92,14 +83,8 @@ export default DropdownSelectBoxComponent.extend({actions: {onSelect(value) {switch(value) {- case "reply_as_whisper":- this.set("composerModel.whisper", true);- this.get("composerController").save();- break;-- case "reply_as_not_whisper":- this.set("composerModel.whisper", false);- this.get("composerController").save();+ case "toggle_whisper":+ this.set("composerModel.whisper", !this.get("composerModel.whisper"));break;case "reply_to_topic":diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 158923c3f28..cbd757d0397 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -1301,12 +1301,9 @@ en:reply_to_topic:label: Reply to topicdesc: Reply to the original post without replying to a specific post- reply_as_whisper:- label: Reply as whisper- desc: This message will only be visible by staff members- reply_as_not_whisper:- label: Reply as not whisper- desc: This message will be visible by anyone+ toggle_whisper:+ label: Toggle whipser+ desc: Whispers will only be visible by staff membersnotifications:tooltip:diff --git a/test/javascripts/acceptance/composer-actions-test.js.es6 b/test/javascripts/acceptance/composer-actions-test.js.es6index f8b848389ae..3893b2ac99d 100644--- a/test/javascripts/acceptance/composer-actions-test.js.es6+++ b/test/javascripts/acceptance/composer-actions-test.js.es6@@ -19,7 +19,7 @@ QUnit.test('replying to post', assert => {assert.equal(composerActions.rowByIndex(0).value(), 'reply_as_new_topic');assert.equal(composerActions.rowByIndex(1).value(), 'reply_as_private_message');assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic');- assert.equal(composerActions.rowByIndex(3).value(), 'reply_as_whisper');+ assert.equal(composerActions.rowByIndex(3).value(), 'toggle_whisper');});});@@ -51,32 +51,18 @@ QUnit.test('replying to post - reply_to_topic', assert => {});});-QUnit.test('replying to post - reply_as_whisper', assert => {+QUnit.test('replying to post - toggle_whisper', assert => {const composerActions = selectKit('.composer-actions');visit('/t/internationalization-localization/280');click('article#post_3 button.reply');fillIn('.d-editor-input', 'test replying as whisper to topic when intially not a whisper');- composerActions.expand().selectRowByValue('reply_as_whisper');+ composerActions.expand().selectRowByValue('toggle_whisper');andThen(() => {- assert.ok(exists(find('.topic-post:last .post-info.whisper')));- assert.equal(find('.topic-post:last .cooked p').html().trim(), 'test replying as whisper to topic when intially not a whisper');- });-});--QUnit.test('replying to post - reply_as_not_whisper', assert => {- const composerActions = selectKit('.composer-actions');-- visit('/t/internationalization-localization/280');- click('article#post_3 button.reply');- fillIn('.d-editor-input', 'test replying as not a whisper to topic when intially a whisper');- selectKit('.toolbar-popup-menu-options').expand().selectRowByValue('toggleWhisper');- composerActions.expand().selectRowByValue('reply_as_not_whisper');-- andThen(() => {- assert.notOk(exists(find('.topic-post:last .post-info.whisper')));- assert.equal(find('.topic-post:last .cooked p').html().trim(), 'test replying as not a whisper to topic when intially a whisper');+ assert.ok(+ find('.composer-fields .whisper').text().indexOf(I18n.t("composer.whisper")) > 0+ );});});