FEATURE: Add reply_as_new_group_message composer action (#10168)

This commit is contained in:
Bianca Nenciu
2020-07-07 18:30:48 +03:00
committed by GitHub
parent ab4c0a4970
commit 6705c45156
3 changed files with 293 additions and 0 deletions

View File

@@ -89,9 +89,30 @@ export default DropdownSelectBoxComponent.extend({
content: computed("seq", function() {
let items = [];
if (
this.action === REPLY &&
this.topic.isPrivateMessage &&
(this.topic.details.allowed_users.length > 1 ||
this.topic.details.allowed_groups.length > 0) &&
!this.isEditing &&
_topicSnapshot
) {
items.push({
name: I18n.t(
"composer.composer_actions.reply_as_new_group_message.label"
),
description: I18n.t(
"composer.composer_actions.reply_as_new_group_message.desc"
),
icon: "plus",
id: "reply_as_new_group_message"
});
}
if (
this.action !== CREATE_TOPIC &&
this.action !== CREATE_SHARED_DRAFT &&
!(this.action === REPLY && this.topic.isPrivateMessage) &&
!this.isEditing &&
_topicSnapshot
) {
@@ -239,6 +260,21 @@ export default DropdownSelectBoxComponent.extend({
model.toggleProperty("noBump");
},
replyAsNewGroupMessageSelected(options) {
const recipients = [];
const details = this.topic.details;
details.allowed_users.forEach(u => recipients.push(u.username));
details.allowed_groups.forEach(g => recipients.push(g.name));
options.action = PRIVATE_MESSAGE;
options.recipients = recipients.join(",");
options.archetypeId = "private_message";
options.skipDraftCheck = true;
this._replyFromExisting(options, _postSnapshot, _topicSnapshot);
},
replyToTopicSelected(options) {
options.action = REPLY;
options.topic = _topicSnapshot;