Skip to content

A platform for community discussion. Free, open, simple.

DEV: add create pm in composer improvements (#35782)

Yuriy Kurant08b6b53b9e2f
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 84fd38de84b..b79b5d8d95b 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -3095,7 +3095,7 @@ en:
label: Toggle whisper
desc: Whispers are only visible to staff members
create_topic:
- label: "New Topic"
+ label: "New topic"
desc: Create a new topic
create_personal_message:
label: "New message"
@@ -3617,7 +3617,7 @@ en:
one: "%{count} post in topic"
other: "%{count} posts in topic"
create: "New Topic"
- create_long: "Create a new Topic"
+ create_long: "Create a new topic"
open_draft: "Open Draft"
private_message: "Start a message"
archive_message:
diff --git a/frontend/discourse/app/components/composer-body.js b/frontend/discourse/app/components/composer-body.js
index 1a7ce1a9cd8..0014ab2f922 100644
--- a/frontend/discourse/app/components/composer-body.js
+++ b/frontend/discourse/app/components/composer-body.js
@@ -1,6 +1,7 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
import { cancel, schedule } from "@ember/runloop";
+import { dasherize } from "@ember/string";
import { classNameBindings } from "@ember-decorators/component";
import { observes } from "@ember-decorators/object";
import discourseDebounce from "discourse/lib/debounce";
@@ -27,7 +28,7 @@ export default class ComposerBody extends Component {
@discourseComputed("composer.action")
prefixedComposerAction(action) {
- return action ? `composer-action-${action}` : "";
+ return action ? `composer-action-${dasherize(action)}` : "";
}
@discourseComputed("currentUser.primary_group_name")
diff --git a/frontend/discourse/app/services/composer.js b/frontend/discourse/app/services/composer.js
index 4bfc36925cf..4fc1d56020a 100644
--- a/frontend/discourse/app/services/composer.js
+++ b/frontend/discourse/app/services/composer.js
@@ -554,20 +554,20 @@ export default class ComposerService extends Service {
}
}
- // Use this to open the composer when you are not sure whether it is
- // already open and whether it already has a draft being worked on. Supports
- // options to append text once the composer is open if required.
- //
- // opts:
- //
- // - topic: if this is present, the composer will be opened with the reply
- // action and the current topic key and draft sequence
- // - fallbackToNewTopic: if true, and there is no draft and no topic,
- // the composer will be opened with the create_topic action and a new
- // topic draft key
- // - insertText: the text to append to the composer once it is opened
- // - openOpts: this object will be passed to this.open if fallbackToNewTopic is
- // true or topic is provided
+ /**
+ * Opens the composer when uncertain if it's already open or has a draft.
+ * Supports appending text once the composer is open.
+ *
+ * @param {Object} opts - Configuration options
+ * @param {Object} [opts.topic] - If provided, opens composer with reply action,
+ * using the current topic key and draft sequence
+ * @param {boolean} [opts.fallbackToNewTopic] - If true and no draft/topic exists,
+ * opens composer with create_topic action and new topic draft key
+ * @param {string} [opts.insertText] - Text to append to the composer after opening
+ * @param {Object} [opts.openOpts] - Additional options passed to this.open when
+ * fallbackToNewTopic is true or topic is provided
+ * @returns {Promise<void>}
+ */
@action
async focusComposer(opts = {}) {
await this._openComposerForFocus(opts);
diff --git a/frontend/select-kit/addon/components/composer-actions.js b/frontend/select-kit/addon/components/composer-actions.js
index 6650cdb93bf..58d7f4b7413 100644
--- a/frontend/select-kit/addon/components/composer-actions.js
+++ b/frontend/select-kit/addon/components/composer-actions.js
@@ -141,9 +141,9 @@ export default class ComposerActions extends DropdownSelectBoxComponent {
}
if (
+ this.action === REPLY &&
this.action !== CREATE_TOPIC &&
this.action !== CREATE_SHARED_DRAFT &&
- this.action === REPLY &&
this.topic &&
!this.topic.isPrivateMessage &&
!this.isEditing &&
diff --git a/plugins/discourse-post-voting/config/locales/client.en.yml b/plugins/discourse-post-voting/config/locales/client.en.yml
index 1751419e310..892e64f06e4 100644
--- a/plugins/discourse-post-voting/config/locales/client.en.yml
+++ b/plugins/discourse-post-voting/config/locales/client.en.yml
@@ -27,10 +27,10 @@ en:
label: "Create post voting topic"
composer_actions:
create_as_post_voting:
- label: "Toggle Post Voting"
+ label: "Toggle post voting"
desc: "Topic will be created with votable posts"
remove_as_post_voting:
- label: "Remove Post Voting"
+ label: "Remove post voting"
desc: "Topic will be created in the regular format"
vote: