FEATURE: Menu toggle for different reply modes

Allow users to access different reply modes from the composer.

Actions introduced:

- reply_as_new_topic
- reply_as_private_message
- reply_to_topic
- reply_as_whisper/not
This commit is contained in:
Joffrey JAFFEUX 2018-02-01 16:42:56 +01:00 committed by GitHub
parent 96710754d9
commit 9923829402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 439 additions and 144 deletions

View File

@ -0,0 +1,63 @@
import { default as computed } from 'ember-addons/ember-computed-decorators';
import { PRIVATE_MESSAGE, CREATE_TOPIC, REPLY, EDIT } from "discourse/models/composer";
import { iconHTML } from 'discourse-common/lib/icon-library';
export default Ember.Component.extend({
classNames: ["composer-action-title"],
options: Ember.computed.alias("model.replyOptions"),
action: Ember.computed.alias("model.action"),
isEditing: Ember.computed.equal("action", EDIT),
@computed("options", "action")
actionTitle(opts, action) {
switch (action) {
case PRIVATE_MESSAGE:
return I18n.t("topic.private_message");
case CREATE_TOPIC:
return I18n.t("topic.create_long");
case REPLY:
if (opts.userAvatar && opts.userLink) {
return this._formatReplyToUserPost(opts.userAvatar, opts.userLink);
} else if (opts.topicLink) {
return this._formatReplyToTopic(opts.topicLink);
}
case EDIT:
if (opts.userAvatar && opts.userLink && opts.topicLink) {
return this._formatEditUserPost(
opts.userAvatar,
opts.userLink,
opts.topicLink,
opts.originalUser
);
}
};
},
_formatEditUserPost(userAvatar, userLink, topicLink, originalUser) {
let editTitle = `
<a class="topic-link" href="${topicLink.href}">${topicLink.anchor}</a>
${userAvatar}
<span class="username">${userLink.anchor}</span>
${iconHTML("mail-forward", { class: "reply-to-glyph" })}
`;
if (originalUser) {
editTitle += `
${originalUser.avatar}
<span class="original-username">${originalUser.username}</span>
`;
}
return editTitle.htmlSafe();
},
_formatReplyToTopic(link) {
return `<a class="topic-link" href="${link.href}">${link.anchor}</a>`.htmlSafe();
},
_formatReplyToUserPost(avatar, link) {
const htmlLink = `<a class="user-link" href="${link.href}">${link.anchor}</a>`;
return `${avatar}${htmlLink}`.htmlSafe();
},
});

View File

@ -1,4 +1,3 @@
import { iconHTML } from 'discourse-common/lib/icon-library';
import RestModel from 'discourse/models/rest';
import Topic from 'discourse/models/topic';
import { throwAjaxError } from 'discourse/lib/ajax-error';
@ -6,45 +5,45 @@ import Quote from 'discourse/lib/quote';
import Draft from 'discourse/models/draft';
import computed from 'ember-addons/ember-computed-decorators';
import { escapeExpression, tinyAvatar } from 'discourse/lib/utilities';
import { emojiUnescape } from 'discourse/lib/text';
// The actions the composer can take
export const
CREATE_TOPIC = 'createTopic',
PRIVATE_MESSAGE = 'privateMessage',
NEW_PRIVATE_MESSAGE_KEY = 'new_private_message',
REPLY = 'reply',
EDIT = 'edit',
REPLY_AS_NEW_TOPIC_KEY = "reply_as_new_topic",
REPLY_AS_NEW_PRIVATE_MESSAGE_KEY = "reply_as_new_private_message";
const CLOSED = 'closed',
SAVING = 'saving',
OPEN = 'open',
DRAFT = 'draft',
SAVING = 'saving',
OPEN = 'open',
DRAFT = 'draft',
// The actions the composer can take
CREATE_TOPIC = 'createTopic',
PRIVATE_MESSAGE = 'privateMessage',
NEW_PRIVATE_MESSAGE_KEY = 'new_private_message',
REPLY = 'reply',
EDIT = 'edit',
REPLY_AS_NEW_TOPIC_KEY = "reply_as_new_topic",
REPLY_AS_NEW_PRIVATE_MESSAGE_KEY = "reply_as_new_private_message",
// When creating, these fields are moved into the post model from the composer model
_create_serializer = {
raw: 'reply',
title: 'title',
unlist_topic: 'unlistTopic',
category: 'categoryId',
topic_id: 'topic.id',
is_warning: 'isWarning',
whisper: 'whisper',
archetype: 'archetypeId',
target_usernames: 'targetUsernames',
typing_duration_msecs: 'typingTime',
composer_open_duration_msecs: 'composerTime',
tags: 'tags',
featured_link: 'featuredLink'
},
// When creating, these fields are moved into the post model from the composer model
_create_serializer = {
raw: 'reply',
title: 'title',
unlist_topic: 'unlistTopic',
category: 'categoryId',
topic_id: 'topic.id',
is_warning: 'isWarning',
whisper: 'whisper',
archetype: 'archetypeId',
target_usernames: 'targetUsernames',
typing_duration_msecs: 'typingTime',
composer_open_duration_msecs: 'composerTime',
tags: 'tags',
featured_link: 'featuredLink'
},
_edit_topic_serializer = {
title: 'topic.title',
categoryId: 'topic.category.id',
tags: 'topic.tags',
featuredLink: 'topic.featured_link'
};
_edit_topic_serializer = {
title: 'topic.title',
categoryId: 'topic.category.id',
tags: 'topic.tags',
featuredLink: 'topic.featured_link'
};
const _saveLabels = {};
_saveLabels[EDIT] = 'composer.save_edit';
@ -167,52 +166,55 @@ const Composer = RestModel.extend({
return this.get('canEditTopicFeaturedLink') ? 'composer.title_or_link_placeholder' : 'composer.title_placeholder';
},
// Determine the appropriate title for this action
actionTitle: function() {
const topic = this.get('topic');
@computed("action", "post", "topic", "topic.title")
replyOptions(action, post, topic, topicTitle) {
let options = {
userLink: null,
topicLink: null,
postLink: null,
userAvatar: null,
originalUser: null
};
let postLink, topicLink, usernameLink;
if (topic) {
const postNumber = this.get('post.post_number');
postLink = "<a href='" + (topic.get('url')) + "/" + postNumber + "'>" +
I18n.t("post.post_number", { number: postNumber }) + "</a>";
let title = topic.get('fancy_title') || escapeExpression(topic.get('title'));
topicLink = "<a href='" + (topic.get('url')) + "'> " + title + "</a>";
usernameLink = "<a href='" + (topic.get('url')) + "/" + postNumber + "'>" + this.get('post.username') + "</a>";
options.topicLink = {
href: topic.get("url"),
anchor: topic.get("fancy_title") || escapeExpression(topicTitle)
};
}
let postDescription;
const post = this.get('post');
if (post) {
postDescription = I18n.t('post.' + this.get('action'), {
link: postLink,
replyAvatar: tinyAvatar(post.get('avatar_template')),
username: this.get('post.username'),
usernameLink
});
options.label = I18n.t(`post.${action}`);
options.userAvatar = tinyAvatar(post.get("avatar_template"));
if (!this.site.mobileView) {
const replyUsername = post.get('reply_to_user.username');
const replyAvatarTemplate = post.get('reply_to_user.avatar_template');
if (replyUsername && replyAvatarTemplate && this.get('action') === EDIT) {
postDescription += ` ${iconHTML('mail-forward', { class: 'reply-to-glyph' })} ` + tinyAvatar(replyAvatarTemplate) + " " + replyUsername;
const originalUserName = post.get('reply_to_user.username');
const originalUserAvatar = post.get('reply_to_user.avatar_template');
if (originalUserName && originalUserAvatar && action === EDIT) {
options.originalUser = {
username: originalUserName,
avatar: tinyAvatar(originalUserAvatar)
};
}
}
}
switch (this.get('action')) {
case PRIVATE_MESSAGE: return I18n.t('topic.private_message');
case CREATE_TOPIC: return I18n.t('topic.create_long');
case REPLY:
case EDIT:
if (postDescription) return postDescription;
if (topic) return emojiUnescape(I18n.t('post.reply_topic', { link: topicLink }));
if (topic && post) {
const postNumber = post.get("post_number");
options.postLink = {
href: `${topic.get("url")}/${postNumber}`,
anchor: I18n.t("post.post_number", { number: postNumber })
};
options.userLink = {
href: `${topic.get("url")}/${postNumber}`,
anchor: post.get("username")
};
}
}.property('action', 'post', 'topic', 'topic.title'),
return options;
},
// whether to disable the post button
cantSubmitPost: function() {

View File

@ -0,0 +1,12 @@
{{#if isEditing}}
{{d-icon "pencil"}}
{{else}}
{{composer-actions
composerModel=model
options=model.replyOptions
whispering=model.whisper
canWhisper=canWhisper
action=model.action}}
{{/if}}
{{actionTitle}}

View File

@ -16,7 +16,7 @@
{{plugin-outlet name="composer-open" args=(hash model=model)}}
<div class='reply-to'>
<div class="reply-details">
{{{model.actionTitle}}}
{{composer-action-title model=model canWhisper=canWhisper}}
{{#unless site.mobileView}}
{{#if whisperOrUnlistTopicText}}

View File

@ -0,0 +1,132 @@
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
import { default as computed } from "ember-addons/ember-computed-decorators";
import { default as Composer, REPLY, EDIT } from "discourse/models/composer";
export default DropdownSelectBoxComponent.extend({
composerController: Ember.inject.controller("composer"),
pluginApiIdentifiers: ["composer-actions"],
classNames: "composer-actions",
fullWidthOnMobile: true,
collectionHeight: "auto",
autofilterable: false,
filterable: false,
allowInitialValueMutation: false,
allowAutoSelectFirst: false,
showFullTitle: false,
computeHeaderContent() {
let content = this.baseHeaderComputedContent();
switch (this.get("action")) {
case REPLY:
content.icon = "mail-forward";
break;
case EDIT:
content.icon = "pencil";
break;
};
return content;
},
@computed("options", "canWhisper", "whispering", "composerModel.post.username")
content(options, canWhisper, whispering, postUsername) {
let items = [
{
name: I18n.t("composer.composer_actions.reply_as_new_topic.label"),
description: I18n.t("composer.composer_actions.reply_as_new_topic.desc"),
icon: "plus",
id: "reply_as_new_topic"
}
];
if (postUsername && postUsername !== this.currentUser.get("username")) {
items.push({
name: I18n.t("composer.composer_actions.reply_as_private_message.label"),
description: I18n.t("composer.composer_actions.reply_as_private_message.desc"),
icon: "envelope",
id: "reply_as_private_message"
});
}
if (Ember.get(options, "postLink")) {
items.push({
name: I18n.t("composer.composer_actions.reply_to_topic.label"),
description: I18n.t("composer.composer_actions.reply_to_topic.desc"),
icon: "mail-forward",
id: "reply_to_topic"
});
}
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"
});
}
}
return items;
},
_replyFromExisting(options) {
const topicTitle = this.get("composerModel.topic.title");
let url = this.get("composerModel.post.url") || this.get("composerModel.topic.url");
this.get("composerController").open(options).then(() => {
url = `${location.protocol}//${location.host}${url}`;
const link = `[${Handlebars.escapeExpression(topicTitle)}](${url})`;
this.get("composerController").get("model").prependText(`${I18n.t("post.continue_discussion", { postLink: link })}`, {new_line: true});
});
},
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();
break;
case "reply_to_topic":
this.set("composerModel.post", null);
this.get("composerController").save();
break;
case "reply_as_new_topic":
const replyAsNewTopicOpts = {
action: Composer.CREATE_TOPIC,
draftKey: Composer.REPLY_AS_NEW_TOPIC_KEY,
categoryId: this.get("composerModel.topic.category.id")
};
this._replyFromExisting(replyAsNewTopicOpts);
break;
case "reply_as_private_message":
const replyAsPrivateMsgOpts = {
action: Composer.PRIVATE_MESSAGE,
archetypeId: "private_message",
draftKey: Composer.REPLY_AS_NEW_PRIVATE_MESSAGE_KEY,
usernames: this.get("composerModel.post.username")
};
this._replyFromExisting(replyAsPrivateMsgOpts);
break;
}
}
}
});

View File

@ -11,7 +11,7 @@
max-width: 1475px;
width: 100%;
&.hide-preview {
max-width:740px;
max-width:740px;
}
@media screen and (max-width: 1200px) {
min-width: 0;
@ -29,7 +29,7 @@
.saving-text,
.draft-text {
display: none;
padding-left: 10px;
padding-left: 10px;
.spinner {
margin-left: 5px;
border-color: $secondary;
@ -96,11 +96,25 @@
color: $primary-high;
}
.reply-details {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: calc(100% - 100px);
}
.composer-action-title {
display: inline-flex;
align-items: center;
justify-content: space-between;
.topic-link, .user-link, .username {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: calc(100%-125px);
margin-right: 5px;
}
.d-icon {
margin-right: 5px;
}
}
.composer-controls {
margin-left: auto;
margin-right: -5px;
@ -378,4 +392,4 @@ div.ac-wrap {
.md-table {
overflow-y: auto;
}
}

View File

@ -0,0 +1,22 @@
.select-kit {
&.dropdown-select-box {
&.composer-actions {
margin: 0;
.select-kit-header {
background: none;
outline: none;
padding: 0;
.d-icon {
border: 1px solid $primary-low;
padding: 5px;
margin: 0;
&:hover {
background: $primary-low;
}
}
}
}
}
}

View File

@ -1855,8 +1855,6 @@ ar:
many: لقد حدّدت <b>{{count}}</b> منشور.
other: لقد حدّدت <b>{{count}}</b> منشور.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "اقتبس"
edit_reason: "السبب:"
post_number: "المنشور {{number}}"

View File

@ -1505,8 +1505,6 @@ ca:
one: Has seleccionat <b>1</b> publicació
other: Has seleccionat <b>{{count}}</b> publicacions.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Cita"
edit_reason: "Motiu:"
post_number: "publicació {{number}}"

View File

@ -1542,8 +1542,6 @@ cs:
few: Máte označeny <b>{{count}}</b> příspěvky.
other: Máte označeno <b>{{count}}</b> příspěvků.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Cituj"
edit_reason: "Důvod: "
post_number: "příspěvek č. {{number}}"

View File

@ -1540,8 +1540,6 @@ da:
one: Du har valgt <b>1</b> indlæg.
other: Du har valgt <b>{{count}}</b> indlæg.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citér"
edit_reason: "Reason: "
post_number: "indlæg {{number}}"

View File

@ -1695,8 +1695,6 @@ de:
one: Du hast <b>1</b> Beitrag ausgewählt.
other: Du hast <b>{{count}}</b> Beiträge ausgewählt.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Zitat"
edit: "<i class='fa fa-pencil'></i> {{link}} {{replyAvatar}} {{username}}"
edit_reason: "Grund: "

View File

@ -1654,8 +1654,6 @@ el:
one: Έχεις επιλέξει <b>1</b> ανάρτηση.
other: Έχεις επιλέξει <b>{{count}}</b> αναρτήσεις.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Παράθεση"
edit_reason: "Αιτία:"
post_number: "ανάρτηση {{number}}"

View File

@ -1291,6 +1291,23 @@ en:
admin_options_title: "Optional staff settings for this topic"
composer_actions:
reply_as_new_topic:
label: Reply as linked topic
desc: Create a new topic
reply_as_private_message:
label: New message
desc: Create a private message
reply_to_topic:
label: Reply to topic
desc: Reply to the original post without replying to a specific post
reply_as_whisper:
label: Reply as whipser
desc: This message will only be visible by staff members
reply_as_not_whisper:
label: Reply as not whisher
desc: This message will be visible by anyone
notifications:
tooltip:
regular:
@ -1882,8 +1899,6 @@ en:
other: "You have selected <b>{{count}}</b> posts."
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Quote"
edit: "<i class='fa fa-pencil'></i> {{link}} {{replyAvatar}} {{username}}"
edit_reason: "Reason: "

View File

@ -1702,8 +1702,6 @@ es:
one: Has seleccionado <b>1</b> post.
other: Has seleccionado <b>{{count}}</b> posts.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citar"
edit: "<i class='fa fa-pencil'></i>{{link}} {{replyAvatar}} {{username}} "
edit_reason: "Motivo:"

View File

@ -1599,8 +1599,6 @@ et:
one: Oled valinud <b>1</b> postituse.
other: Oled valinud <b>{{count}}</b> postitust.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Tsitaat"
edit_reason: "Põhjus:"
post_number: "postitus {{number}}"

View File

@ -1512,8 +1512,6 @@ fa_IR:
description:
other: شما <b>{{count}}</b> نوشته انتخاب کرده اید
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "نقل‌قول"
edit_reason: "دلیل:"
post_number: "نوشته {{number}}"

View File

@ -1699,8 +1699,6 @@ fi:
one: Olet valinnut <b>yhden</b> viestin.
other: Olet valinnut <b>{{count}}</b> viestiä.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Lainaa"
edit: "<i class='fa fa-pencil'></i> {{link}} {{replyAvatar}} {{username}}"
edit_reason: "Syy:"

View File

@ -1695,8 +1695,6 @@ fr:
one: vous avez sélectionné <b>1</b> message.
other: Vous avez sélectionné <b>{{count}}</b> messages.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citer"
edit: "<i class='fa fa-pencil'></i> {{link}} {{replyAvatar}} {{username}}"
edit_reason: "Raison :"

View File

@ -1188,8 +1188,6 @@ gl:
one: Seleccionaches <b>unha</b> publicación.
other: Seleccionaches <b>{{count}}</b> publicacións.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
edit_reason: "Razón:"
post_number: "publicación {{number}}"
last_edited_on: "última edición da publicación"

View File

@ -1561,8 +1561,6 @@ he:
one: בחרתם פוסט אחד.
other: בחרתם <b>{{count}}</b> פוסטים.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "ציטוט"
edit_reason: "סיבה: "
post_number: "פוסט {{number}}"

View File

@ -1691,8 +1691,6 @@ it:
one: Hai selezionato <b>1</b> messaggio.
other: Hai selezionato <b>{{count}}</b> messaggi.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Cita"
edit_reason: "Motivo:"
post_number: "messaggio {{number}}"

View File

@ -1567,8 +1567,6 @@ ja:
description:
other: <b>{{count}}</b>個の投稿を選択中。
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "引用"
edit_reason: "理由: "
post_number: "投稿{{number}}"

View File

@ -1578,8 +1578,6 @@ ko:
description:
other: <b>{{count}}</b>개의 개시글을 선택하셨어요.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "인용하기"
edit_reason: "Reason: "
post_number: "{{number}}번째 글"

View File

@ -1623,8 +1623,6 @@ lv:
one: Jūs esat izvēlējies <b>1</b> ierakstu.
other: Jūs esat izvēlējies <b>{{count}}</b> ierakstus.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citāts"
edit_reason: "Iemesls:"
post_number: "ieraksts {{number}}"

View File

@ -1702,8 +1702,6 @@ nb_NO:
one: Du har valgt <b>1</b> innlegg.
other: Du har valgt <b>{{count}}</b> innlegg.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Sitat"
edit: "<i class='fa fa-pencil'></i> {{link}} {{replyAvatar}} {{username}}"
edit_reason: "Begrunnelse:"

View File

@ -1623,8 +1623,6 @@ nl:
one: U hebt <b>1</b> bericht geselecteerd.
other: U hebt <b>{{count}}</b> berichten geselecteerd.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citeren"
edit_reason: "Reden: "
post_number: "bericht {{number}}"

View File

@ -1784,8 +1784,6 @@ pl_PL:
many: Wybrano <b>{{count}}</b> wpisów.
other: Wybrano <b>{{count}}</b> wpisów.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Cytuj"
edit_reason: "Powód"
post_number: "wpis {{number}}"

View File

@ -1514,8 +1514,6 @@ pt:
one: Selecionou <b>1</b> publicação.
other: Selecionou <b>{{count}}</b> publicações.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citar"
edit_reason: "Motivo:"
post_number: "publicação {{number}}"

View File

@ -1581,8 +1581,6 @@ pt_BR:
one: <b>1</b> resposta selecionada.
other: <b>{{count}}</b> respostas selecionadas.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citação"
edit_reason: "Motivo:"
post_number: "resposta {{number}}"

View File

@ -1487,8 +1487,6 @@ ro:
few: Ai selectat <b>{{count}}</b> mesaje.
other: Ai selectat <b>{{count}}</b> de mesaje.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citează"
edit_reason: "Motivul edit[rii: "
post_number: "postarea {{number}}"

View File

@ -1687,8 +1687,6 @@ ru:
many: Вы выбрали <b>{{count}}</b> сообщений.
other: Вы выбрали <b>{{count}}</b> сообщений.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Цитата"
edit_reason: "Причина:"
post_number: "сообщение {{number}}"

View File

@ -1428,8 +1428,6 @@ sk:
few: Označili ste <b>{{count}}</b> príspevky
other: Označili ste <b>{{count}}</b> príspevkov
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citácia"
edit_reason: "Dôvod:"
post_number: "príspevok {{number}}"

View File

@ -1391,8 +1391,6 @@ sq:
one: Keni përzgjedhur <b>1</b> postim.
other: Keni përzgjedhur <b>{{count}}</b> postime.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
edit_reason: "Arsyeja:"
post_number: "postimi {{number}}"
last_edited_on: "redaktimi i fundit u krye më"

View File

@ -1485,8 +1485,6 @@ sv:
one: Du har markerat <b>1</b> inlägg.
other: Du har markerat <b>{{count}}</b> inlägg.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Citat"
edit_reason: "Anledning:"
post_number: "inlägg {{number}}"

View File

@ -1129,8 +1129,6 @@ th:
description:
other: คุณได้เลือก <b>{{count}}</b> โพสต์.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
edit_reason: "เหตุผล:"
post_number: "โพสต์ {{number}}"
last_edited_on: "โพสแก้ไขล่าสุดเมื่อ"

View File

@ -1501,8 +1501,6 @@ tr_TR:
description:
other: <b>{{count}}</b> gönderi seçtiniz.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Alıntı"
edit_reason: "Neden: "
post_number: "gönderi {{number}}"

View File

@ -1443,8 +1443,6 @@ ur:
one: آپ نے <b>1</b> پوسٹ منتخب کی ہے۔
other: آپ نے <b>{{count}}</b> پوسٹس منتخب کی ہیں۔
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "اقتباس کریں"
edit_reason: "وجہ:"
post_number: "پوسٹ {{number}}"

View File

@ -1414,8 +1414,6 @@ vi:
description:
other: Bạn đã chọn <b>{{count}}</b> bài viết.
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "Trích dẫn"
edit_reason: "Lý do: "
post_number: "bài viết {{number}}"

View File

@ -1623,8 +1623,6 @@ zh_CN:
description:
other: 已选择 <b>{{count}}</b> 个帖子。
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "引用"
edit: "<i class='fa fa-pencil'></i> {{link}} {{replyAvatar}} {{username}}"
edit_reason: "理由:"

View File

@ -1404,8 +1404,6 @@ zh_TW:
description:
other: 你已選擇了 <b>{{count}}</b> 篇文章。
post:
reply: "<i class='fa fa-mail-forward'></i> {{replyAvatar}} {{usernameLink}}"
reply_topic: "<i class='fa fa-mail-forward'></i> {{link}}"
quote_reply: "引用"
edit_reason: "原因: "
post_number: "文章 {{number}}"

View File

@ -0,0 +1,101 @@
import { acceptance } from 'helpers/qunit-helpers';
acceptance('Composer Actions', {
loggedIn: true,
settings: {
enable_whispers: true
}
});
QUnit.test('replying to post', assert => {
const composerActions = selectKit('.composer-actions');
visit('/t/internationalization-localization/280');
click('article#post_3 button.reply');
composerActions.expand();
andThen(() => {
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');
});
});
QUnit.test('replying to post - reply_as_private_message', assert => {
const composerActions = selectKit('.composer-actions');
visit('/t/internationalization-localization/280');
click('article#post_3 button.reply');
composerActions.expand().selectRowByValue('reply_as_private_message');
andThen(() => {
assert.equal(find('.users-input .item:eq(0)').text(), 'codinghorror');
assert.ok(find('.d-editor-input').val().indexOf('Continuing the discussion') >= 0);
});
});
QUnit.test('replying to post - reply_to_topic', assert => {
const composerActions = selectKit('.composer-actions');
visit('/t/internationalization-localization/280');
click('article#post_3 button.reply');
fillIn('.d-editor-input', 'test replying to topic when intially replied to post');
composerActions.expand().selectRowByValue('reply_to_topic');
andThen(() => {
assert.equal(find('.topic-post:last .cooked p').html().trim(), 'test replying to topic when intially replied to post');
assert.notOk(exists(find('.topic-post:last .reply-to-tab')));
});
});
QUnit.test('replying to post - reply_as_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');
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');
});
});
QUnit.test('replying to post - reply_as_new_topic', assert => {
const composerActions = selectKit('.composer-actions');
const categoryChooser = selectKit('.title-wrapper .category-chooser');
const categoryChooserReplyArea = selectKit('.reply-area .category-chooser');
visit('/t/internationalization-localization/280');
click('#topic-title .d-icon-pencil');
categoryChooser.expand().selectRowByValue(4);
click('#topic-title .submit-edit');
click('article#post_3 button.reply');
composerActions.expand().selectRowByValue('reply_as_new_topic');
andThen(() => {
assert.equal(categoryChooserReplyArea.header().name(), 'faq');
assert.ok(find('.d-editor-input').val().indexOf('Continuing the discussion') >= 0);
});
});