2024-08-23 19:17:07 +08:00
|
|
|
import { action } from "@ember/object";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { equal, gt } from "@ember/object/computed";
|
2024-03-07 01:05:11 +08:00
|
|
|
import { service } from "@ember/service";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { camelize } from "@ember/string";
|
|
|
|
import { isEmpty } from "@ember/utils";
|
2024-08-23 19:17:07 +08:00
|
|
|
import { classNames } from "@ember-decorators/component";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { escapeExpression } from "discourse/lib/utilities";
|
2018-03-14 03:59:12 +08:00
|
|
|
import {
|
|
|
|
CREATE_SHARED_DRAFT,
|
2020-05-14 13:56:45 +08:00
|
|
|
CREATE_TOPIC,
|
|
|
|
EDIT,
|
2018-03-14 03:59:12 +08:00
|
|
|
PRIVATE_MESSAGE,
|
2020-12-02 02:31:26 +08:00
|
|
|
REPLY,
|
2018-03-14 03:59:12 +08:00
|
|
|
} from "discourse/models/composer";
|
2020-02-04 23:59:56 +08:00
|
|
|
import Draft from "discourse/models/draft";
|
2023-10-11 02:38:59 +08:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2024-11-20 04:45:18 +08:00
|
|
|
import { i18n } from "discourse-i18n";
|
2023-10-11 02:38:59 +08:00
|
|
|
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
2024-08-23 19:17:07 +08:00
|
|
|
import { pluginApiIdentifiers, selectKitOptions } from "./select-kit";
|
2018-02-08 18:46:55 +08:00
|
|
|
|
|
|
|
// Component can get destroyed and lose state
|
|
|
|
let _topicSnapshot = null;
|
|
|
|
let _postSnapshot = null;
|
2020-05-16 01:54:44 +08:00
|
|
|
let _actionSnapshot = null;
|
2018-02-08 18:46:55 +08:00
|
|
|
|
|
|
|
export function _clearSnapshots() {
|
|
|
|
_topicSnapshot = null;
|
|
|
|
_postSnapshot = null;
|
2020-05-16 01:54:44 +08:00
|
|
|
_actionSnapshot = null;
|
2018-02-08 18:46:55 +08:00
|
|
|
}
|
2018-02-01 23:42:56 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@classNames("composer-actions")
|
|
|
|
@pluginApiIdentifiers(["composer-actions"])
|
|
|
|
@selectKitOptions({
|
|
|
|
icon: "iconForComposerAction",
|
|
|
|
filterable: false,
|
|
|
|
showFullTitle: false,
|
|
|
|
preventHeaderFocus: true,
|
|
|
|
customStyle: true,
|
|
|
|
})
|
|
|
|
export default class ComposerActions extends DropdownSelectBoxComponent {
|
|
|
|
@service dialog;
|
|
|
|
@service composer;
|
|
|
|
|
|
|
|
seq = 0;
|
|
|
|
|
|
|
|
@equal("action", EDIT) isEditing;
|
|
|
|
@gt("topic.slow_mode_seconds", 0) isInSlowMode;
|
2018-02-01 23:42:56 +08:00
|
|
|
|
2021-04-18 03:40:09 +08:00
|
|
|
@discourseComputed("isEditing", "action", "whisper", "noBump", "isInSlowMode")
|
2024-08-23 19:17:07 +08:00
|
|
|
iconForComposerAction(
|
|
|
|
isEditing,
|
|
|
|
composerAction,
|
|
|
|
whisper,
|
|
|
|
noBump,
|
|
|
|
isInSlowMode
|
|
|
|
) {
|
|
|
|
if (composerAction === CREATE_TOPIC) {
|
2020-05-15 16:40:49 +08:00
|
|
|
return "plus";
|
2024-08-23 19:17:07 +08:00
|
|
|
} else if (composerAction === PRIVATE_MESSAGE) {
|
2021-03-19 22:48:43 +08:00
|
|
|
return "envelope";
|
2024-08-23 19:17:07 +08:00
|
|
|
} else if (composerAction === CREATE_SHARED_DRAFT) {
|
2021-03-19 22:48:43 +08:00
|
|
|
return "far-clipboard";
|
2021-04-18 03:40:09 +08:00
|
|
|
} else if (whisper) {
|
2021-03-19 22:48:43 +08:00
|
|
|
return "far-eye-slash";
|
2021-04-18 03:40:09 +08:00
|
|
|
} else if (noBump) {
|
2021-03-19 22:48:43 +08:00
|
|
|
return "anchor";
|
2021-04-18 03:40:09 +08:00
|
|
|
} else if (isInSlowMode) {
|
|
|
|
return "hourglass-start";
|
|
|
|
} else if (isEditing) {
|
2024-09-13 23:50:52 +08:00
|
|
|
return "pencil";
|
2020-05-15 16:40:49 +08:00
|
|
|
} else {
|
|
|
|
return "share";
|
|
|
|
}
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2020-05-14 13:56:45 +08:00
|
|
|
|
2020-03-31 11:40:00 +08:00
|
|
|
contentChanged() {
|
2020-04-02 07:21:57 +08:00
|
|
|
this.set("seq", this.seq + 1);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2020-03-31 11:40:00 +08:00
|
|
|
|
2018-02-08 18:46:55 +08:00
|
|
|
didReceiveAttrs() {
|
2024-08-23 19:17:07 +08:00
|
|
|
super.didReceiveAttrs(...arguments);
|
2020-05-16 01:54:44 +08:00
|
|
|
let changeContent = false;
|
2018-02-08 18:46:55 +08:00
|
|
|
|
|
|
|
// if we change topic we want to change both snapshots
|
|
|
|
if (
|
2020-04-01 11:23:26 +08:00
|
|
|
this.topic &&
|
|
|
|
(!_topicSnapshot || this.topic.id !== _topicSnapshot.id)
|
2018-02-08 18:46:55 +08:00
|
|
|
) {
|
2020-04-01 11:23:26 +08:00
|
|
|
_topicSnapshot = this.topic;
|
|
|
|
_postSnapshot = this.post;
|
2020-05-16 01:54:44 +08:00
|
|
|
changeContent = true;
|
2018-02-08 18:46:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// if we hit reply on a different post we want to change postSnapshot
|
2020-04-01 11:23:26 +08:00
|
|
|
if (this.post && (!_postSnapshot || this.post.id !== _postSnapshot.id)) {
|
|
|
|
_postSnapshot = this.post;
|
2020-05-16 01:54:44 +08:00
|
|
|
changeContent = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.action !== _actionSnapshot) {
|
|
|
|
_actionSnapshot = this.action;
|
|
|
|
changeContent = true;
|
2018-02-08 18:46:55 +08:00
|
|
|
}
|
|
|
|
|
2020-05-16 01:54:44 +08:00
|
|
|
if (changeContent) {
|
|
|
|
this.contentChanged();
|
2018-02-01 23:42:56 +08:00
|
|
|
}
|
2020-05-16 01:54:44 +08:00
|
|
|
|
|
|
|
this.set("selectKit.isHidden", isEmpty(this.content));
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-02-01 23:42:56 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
modifySelection() {
|
|
|
|
return {};
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-02-01 23:42:56 +08:00
|
|
|
|
2021-04-18 03:40:09 +08:00
|
|
|
@discourseComputed("seq")
|
|
|
|
content() {
|
2018-02-08 18:46:55 +08:00
|
|
|
let items = [];
|
|
|
|
|
2020-07-07 23:30:48 +08:00
|
|
|
if (
|
|
|
|
this.action === REPLY &&
|
2020-07-15 09:38:28 +08:00
|
|
|
this.topic &&
|
2020-07-07 23:30:48 +08:00
|
|
|
this.topic.isPrivateMessage &&
|
2020-07-15 09:38:28 +08:00
|
|
|
this.topic.details &&
|
2020-07-07 23:30:48 +08:00
|
|
|
(this.topic.details.allowed_users.length > 1 ||
|
|
|
|
this.topic.details.allowed_groups.length > 0) &&
|
|
|
|
!this.isEditing &&
|
|
|
|
_topicSnapshot
|
|
|
|
) {
|
|
|
|
items.push({
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n(
|
2020-07-07 23:30:48 +08:00
|
|
|
"composer.composer_actions.reply_as_new_group_message.label"
|
|
|
|
),
|
2024-11-20 04:45:18 +08:00
|
|
|
description: i18n(
|
2020-07-07 23:30:48 +08:00
|
|
|
"composer.composer_actions.reply_as_new_group_message.desc"
|
|
|
|
),
|
|
|
|
icon: "plus",
|
|
|
|
id: "reply_as_new_group_message",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-05-24 00:25:58 +08:00
|
|
|
if (
|
2020-02-03 21:22:14 +08:00
|
|
|
this.action !== CREATE_TOPIC &&
|
|
|
|
this.action !== CREATE_SHARED_DRAFT &&
|
2022-06-08 00:06:42 +08:00
|
|
|
this.action === REPLY &&
|
|
|
|
this.topic &&
|
|
|
|
!this.topic.isPrivateMessage &&
|
2020-05-14 13:56:45 +08:00
|
|
|
!this.isEditing &&
|
2024-02-13 06:26:13 +08:00
|
|
|
this.currentUser.can_create_topic &&
|
2018-05-24 00:25:58 +08:00
|
|
|
_topicSnapshot
|
|
|
|
) {
|
2018-02-08 18:46:55 +08:00
|
|
|
items.push({
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("composer.composer_actions.reply_as_new_topic.label"),
|
|
|
|
description: i18n("composer.composer_actions.reply_as_new_topic.desc"),
|
2018-02-01 23:42:56 +08:00
|
|
|
icon: "plus",
|
|
|
|
id: "reply_as_new_topic",
|
2018-02-08 18:46:55 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
2020-02-03 21:22:14 +08:00
|
|
|
(this.action !== REPLY && _postSnapshot) ||
|
|
|
|
(this.action === REPLY &&
|
2018-02-08 18:46:55 +08:00
|
|
|
_postSnapshot &&
|
2020-02-03 21:22:14 +08:00
|
|
|
!(this.replyOptions.userAvatar && this.replyOptions.userLink))
|
2018-02-08 18:46:55 +08:00
|
|
|
) {
|
|
|
|
items.push({
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("composer.composer_actions.reply_to_post.label", {
|
2020-02-03 21:22:14 +08:00
|
|
|
postUsername: _postSnapshot.username,
|
2018-02-08 18:46:55 +08:00
|
|
|
}),
|
2024-11-20 04:45:18 +08:00
|
|
|
description: i18n("composer.composer_actions.reply_to_post.desc"),
|
2019-01-23 03:42:00 +08:00
|
|
|
icon: "share",
|
2018-02-08 18:46:55 +08:00
|
|
|
id: "reply_to_post",
|
|
|
|
});
|
|
|
|
}
|
2018-02-01 23:42:56 +08:00
|
|
|
|
2018-02-08 18:46:55 +08:00
|
|
|
if (
|
2020-05-14 13:56:45 +08:00
|
|
|
!this.isEditing &&
|
|
|
|
((this.action !== REPLY && _topicSnapshot) ||
|
|
|
|
(this.action === REPLY &&
|
|
|
|
_topicSnapshot &&
|
|
|
|
this.replyOptions.userAvatar &&
|
|
|
|
this.replyOptions.userLink &&
|
|
|
|
this.replyOptions.topicLink))
|
2018-02-08 18:46:55 +08:00
|
|
|
) {
|
2018-02-01 23:42:56 +08:00
|
|
|
items.push({
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("composer.composer_actions.reply_to_topic.label"),
|
|
|
|
description: i18n("composer.composer_actions.reply_to_topic.desc"),
|
2019-01-23 03:42:00 +08:00
|
|
|
icon: "share",
|
2018-02-01 23:42:56 +08:00
|
|
|
id: "reply_to_topic",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-02-08 18:46:55 +08:00
|
|
|
// if answered post is a whisper, we can only answer with a whisper so no need for toggle
|
2018-02-08 21:18:53 +08:00
|
|
|
if (
|
2020-02-03 21:22:14 +08:00
|
|
|
this.canWhisper &&
|
2022-06-15 07:59:57 +08:00
|
|
|
(!this.replyOptions.postLink ||
|
|
|
|
!_postSnapshot ||
|
2020-05-07 22:28:28 +08:00
|
|
|
_postSnapshot.post_type !== this.site.post_types.whisper)
|
2018-02-08 21:18:53 +08:00
|
|
|
) {
|
2018-02-02 06:07:37 +08:00
|
|
|
items.push({
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("composer.composer_actions.toggle_whisper.label"),
|
|
|
|
description: i18n("composer.composer_actions.toggle_whisper.desc"),
|
2019-01-22 19:02:02 +08:00
|
|
|
icon: "far-eye-slash",
|
2018-02-02 06:07:37 +08:00
|
|
|
id: "toggle_whisper",
|
|
|
|
});
|
2018-02-01 23:42:56 +08:00
|
|
|
}
|
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
if (this.action === CREATE_TOPIC) {
|
2018-03-14 03:59:12 +08:00
|
|
|
if (this.site.shared_drafts_category_id) {
|
|
|
|
// Shared Drafts Choice
|
|
|
|
items.push({
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("composer.composer_actions.shared_draft.label"),
|
|
|
|
description: i18n("composer.composer_actions.shared_draft.desc"),
|
2019-07-16 23:13:44 +08:00
|
|
|
icon: "far-clipboard",
|
2018-03-14 03:59:12 +08:00
|
|
|
id: "shared_draft",
|
|
|
|
});
|
|
|
|
}
|
2018-02-10 05:58:04 +08:00
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
|
2019-01-03 03:15:12 +08:00
|
|
|
const showToggleTopicBump =
|
2019-07-26 17:20:11 +08:00
|
|
|
this.get("currentUser.staff") ||
|
|
|
|
this.get("currentUser.trust_level") === 4;
|
2018-08-10 08:48:30 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
if (this.action === REPLY && showToggleTopicBump) {
|
2018-08-10 08:48:30 +08:00
|
|
|
items.push({
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("composer.composer_actions.toggle_topic_bump.label"),
|
|
|
|
description: i18n("composer.composer_actions.toggle_topic_bump.desc"),
|
2018-08-10 08:48:30 +08:00
|
|
|
icon: "anchor",
|
|
|
|
id: "toggle_topic_bump",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-02-13 06:26:13 +08:00
|
|
|
if (items.length === 0 && this.currentUser.can_create_topic) {
|
2021-12-03 02:46:40 +08:00
|
|
|
items.push({
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("composer.composer_actions.create_topic.label"),
|
|
|
|
description: i18n("composer.composer_actions.create_topic.desc"),
|
2021-12-03 02:46:40 +08:00
|
|
|
icon: "share",
|
|
|
|
id: "create_topic",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-02-01 23:42:56 +08:00
|
|
|
return items;
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-02-01 23:42:56 +08:00
|
|
|
|
2023-08-11 16:53:44 +08:00
|
|
|
_continuedFromText(post, topic) {
|
|
|
|
let url = post?.url || topic?.url;
|
|
|
|
const topicTitle = topic?.title;
|
|
|
|
|
|
|
|
if (!url || !topicTitle) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
url = `${location.protocol}//${location.host}${url}`;
|
|
|
|
const link = `[${escapeExpression(topicTitle)}](${url})`;
|
2024-11-20 04:45:18 +08:00
|
|
|
return i18n("post.continue_discussion", {
|
2023-08-11 16:53:44 +08:00
|
|
|
postLink: link,
|
|
|
|
});
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2023-08-11 16:53:44 +08:00
|
|
|
|
2018-02-08 18:46:55 +08:00
|
|
|
_replyFromExisting(options, post, topic) {
|
2023-08-11 16:53:44 +08:00
|
|
|
this.composer.closeComposer();
|
|
|
|
this.composer.open({
|
|
|
|
...options,
|
|
|
|
prependText: this._continuedFromText(post, topic),
|
|
|
|
});
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-02-01 23:42:56 +08:00
|
|
|
|
2018-03-14 03:59:12 +08:00
|
|
|
_openComposer(options) {
|
2023-08-11 16:53:44 +08:00
|
|
|
this.composer.closeComposer();
|
|
|
|
this.composer.open(options);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
|
|
|
|
toggleWhisperSelected(options, model) {
|
|
|
|
model.toggleProperty("whisper");
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
|
2018-08-10 08:48:30 +08:00
|
|
|
toggleTopicBumpSelected(options, model) {
|
|
|
|
model.toggleProperty("noBump");
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-08-10 08:48:30 +08:00
|
|
|
|
2020-07-07 23:30:48 +08:00
|
|
|
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);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2020-07-07 23:30:48 +08:00
|
|
|
|
2018-03-14 03:59:12 +08:00
|
|
|
replyToTopicSelected(options) {
|
|
|
|
options.action = REPLY;
|
|
|
|
options.topic = _topicSnapshot;
|
2019-03-28 04:55:09 +08:00
|
|
|
options.skipDraftCheck = true;
|
2018-03-14 03:59:12 +08:00
|
|
|
this._openComposer(options);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
|
|
|
|
replyToPostSelected(options) {
|
|
|
|
options.action = REPLY;
|
|
|
|
options.post = _postSnapshot;
|
2019-03-28 04:55:09 +08:00
|
|
|
options.skipDraftCheck = true;
|
2018-03-14 03:59:12 +08:00
|
|
|
this._openComposer(options);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
|
|
|
|
replyAsNewTopicSelected(options) {
|
2020-02-04 23:59:56 +08:00
|
|
|
Draft.get("new_topic").then((response) => {
|
|
|
|
if (response.draft) {
|
2022-10-07 23:38:27 +08:00
|
|
|
this.dialog.confirm({
|
2024-11-20 04:45:18 +08:00
|
|
|
message: i18n("composer.composer_actions.reply_as_new_topic.confirm"),
|
2022-10-07 23:38:27 +08:00
|
|
|
confirmButtonLabel: "composer.ok_proceed",
|
|
|
|
didConfirm: () => this._replyAsNewTopicSelect(options),
|
|
|
|
});
|
2020-02-04 23:59:56 +08:00
|
|
|
} else {
|
|
|
|
this._replyAsNewTopicSelect(options);
|
|
|
|
}
|
|
|
|
});
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2020-02-04 23:59:56 +08:00
|
|
|
|
|
|
|
_replyAsNewTopicSelect(options) {
|
2018-03-14 03:59:12 +08:00
|
|
|
options.action = CREATE_TOPIC;
|
|
|
|
options.categoryId = this.get("composerModel.topic.category.id");
|
2019-02-13 22:19:58 +08:00
|
|
|
options.disableScopedCategory = true;
|
2019-10-21 05:57:55 +08:00
|
|
|
options.skipDraftCheck = true;
|
2018-03-14 03:59:12 +08:00
|
|
|
this._replyFromExisting(options, _postSnapshot, _topicSnapshot);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
|
|
|
|
replyAsPrivateMessageSelected(options) {
|
|
|
|
let usernames;
|
|
|
|
|
|
|
|
if (_postSnapshot && !_postSnapshot.get("yours")) {
|
|
|
|
const postUsername = _postSnapshot.get("username");
|
|
|
|
if (postUsername) {
|
|
|
|
usernames = postUsername;
|
|
|
|
}
|
2018-08-23 17:09:35 +08:00
|
|
|
} else if (this.get("composerModel.topic")) {
|
|
|
|
const stream = this.get("composerModel.topic.postStream");
|
|
|
|
|
|
|
|
if (stream.get("firstPostPresent")) {
|
|
|
|
const post = stream.get("posts.firstObject");
|
|
|
|
if (post && !post.get("yours") && post.get("username")) {
|
|
|
|
usernames = post.get("username");
|
|
|
|
}
|
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
options.action = PRIVATE_MESSAGE;
|
2020-07-17 03:23:08 +08:00
|
|
|
options.recipients = usernames;
|
2018-03-14 03:59:12 +08:00
|
|
|
options.archetypeId = "private_message";
|
2019-10-21 05:57:55 +08:00
|
|
|
options.skipDraftCheck = true;
|
2018-03-14 03:59:12 +08:00
|
|
|
|
|
|
|
this._replyFromExisting(options, _postSnapshot, _topicSnapshot);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
_switchCreate(options, composerAction) {
|
|
|
|
options.action = composerAction;
|
2018-03-14 03:59:12 +08:00
|
|
|
options.categoryId = this.get("composerModel.categoryId");
|
|
|
|
options.topicTitle = this.get("composerModel.title");
|
2019-01-23 00:26:52 +08:00
|
|
|
options.tags = this.get("composerModel.tags");
|
2018-12-19 17:25:33 +08:00
|
|
|
options.skipDraftCheck = true;
|
2018-03-14 03:59:12 +08:00
|
|
|
this._openComposer(options);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
|
|
|
|
createTopicSelected(options) {
|
|
|
|
this._switchCreate(options, CREATE_TOPIC);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2018-03-14 03:59:12 +08:00
|
|
|
|
|
|
|
sharedDraftSelected(options) {
|
|
|
|
this._switchCreate(options, CREATE_SHARED_DRAFT);
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
onChange(value) {
|
|
|
|
const composerAction = `${camelize(value)}Selected`;
|
|
|
|
if (this[composerAction]) {
|
|
|
|
this[composerAction](
|
|
|
|
this.composerModel.getProperties(
|
|
|
|
"draftKey",
|
|
|
|
"draftSequence",
|
|
|
|
"title",
|
|
|
|
"reply",
|
|
|
|
"disableScopedCategory"
|
|
|
|
),
|
|
|
|
this.composerModel
|
|
|
|
);
|
|
|
|
this.contentChanged();
|
|
|
|
} else {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.error(`No method '${composerAction}' found`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|