mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
FIX: makes composer-actions toggling whisper instead of replying
This commit is contained in:
@ -4,7 +4,6 @@
|
|||||||
{{composer-actions
|
{{composer-actions
|
||||||
composerModel=model
|
composerModel=model
|
||||||
options=model.replyOptions
|
options=model.replyOptions
|
||||||
whispering=model.whisper
|
|
||||||
canWhisper=canWhisper
|
canWhisper=canWhisper
|
||||||
action=model.action}}
|
action=model.action}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -28,8 +28,8 @@ export default DropdownSelectBoxComponent.extend({
|
|||||||
return content;
|
return content;
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("options", "canWhisper", "whispering", "composerModel.post.username")
|
@computed("options", "canWhisper", "composerModel.post.username")
|
||||||
content(options, canWhisper, whispering, postUsername) {
|
content(options, canWhisper, postUsername) {
|
||||||
let items = [
|
let items = [
|
||||||
{
|
{
|
||||||
name: I18n.t("composer.composer_actions.reply_as_new_topic.label"),
|
name: I18n.t("composer.composer_actions.reply_as_new_topic.label"),
|
||||||
@ -58,22 +58,13 @@ export default DropdownSelectBoxComponent.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (canWhisper) {
|
if (canWhisper) {
|
||||||
if (whispering) {
|
|
||||||
items.push({
|
items.push({
|
||||||
name: I18n.t("composer.composer_actions.reply_as_not_whisper.label"),
|
name: I18n.t("composer.composer_actions.toggle_whisper.label"),
|
||||||
description: I18n.t("composer.composer_actions.reply_as_not_whisper.desc"),
|
description: I18n.t("composer.composer_actions.toggle_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",
|
icon: "eye-slash",
|
||||||
id: "reply_as_whisper"
|
id: "toggle_whisper"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
},
|
},
|
||||||
@ -92,14 +83,8 @@ export default DropdownSelectBoxComponent.extend({
|
|||||||
actions: {
|
actions: {
|
||||||
onSelect(value) {
|
onSelect(value) {
|
||||||
switch(value) {
|
switch(value) {
|
||||||
case "reply_as_whisper":
|
case "toggle_whisper":
|
||||||
this.set("composerModel.whisper", true);
|
this.set("composerModel.whisper", !this.get("composerModel.whisper"));
|
||||||
this.get("composerController").save();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "reply_as_not_whisper":
|
|
||||||
this.set("composerModel.whisper", false);
|
|
||||||
this.get("composerController").save();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "reply_to_topic":
|
case "reply_to_topic":
|
||||||
|
@ -1301,12 +1301,9 @@ en:
|
|||||||
reply_to_topic:
|
reply_to_topic:
|
||||||
label: Reply to topic
|
label: Reply to topic
|
||||||
desc: Reply to the original post without replying to a specific post
|
desc: Reply to the original post without replying to a specific post
|
||||||
reply_as_whisper:
|
toggle_whisper:
|
||||||
label: Reply as whisper
|
label: Toggle whipser
|
||||||
desc: This message will only be visible by staff members
|
desc: Whispers will only be visible by staff members
|
||||||
reply_as_not_whisper:
|
|
||||||
label: Reply as not whisper
|
|
||||||
desc: This message will be visible by anyone
|
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
tooltip:
|
tooltip:
|
||||||
|
@ -19,7 +19,7 @@ QUnit.test('replying to post', assert => {
|
|||||||
assert.equal(composerActions.rowByIndex(0).value(), 'reply_as_new_topic');
|
assert.equal(composerActions.rowByIndex(0).value(), 'reply_as_new_topic');
|
||||||
assert.equal(composerActions.rowByIndex(1).value(), 'reply_as_private_message');
|
assert.equal(composerActions.rowByIndex(1).value(), 'reply_as_private_message');
|
||||||
assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic');
|
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');
|
const composerActions = selectKit('.composer-actions');
|
||||||
|
|
||||||
visit('/t/internationalization-localization/280');
|
visit('/t/internationalization-localization/280');
|
||||||
click('article#post_3 button.reply');
|
click('article#post_3 button.reply');
|
||||||
fillIn('.d-editor-input', 'test replying as whisper to topic when intially not a whisper');
|
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(() => {
|
andThen(() => {
|
||||||
assert.ok(exists(find('.topic-post:last .post-info.whisper')));
|
assert.ok(
|
||||||
assert.equal(find('.topic-post:last .cooked p').html().trim(), 'test replying as whisper to topic when intially not a whisper');
|
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.whisper")) > 0
|
||||||
});
|
);
|
||||||
});
|
|
||||||
|
|
||||||
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');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user