A platform for community discussion. Free, open, simple.
DEV: post type dropdown cleanup (#42589)
Jordan Vidrinef6cd2193e614
diff --git a/app/assets/stylesheets/common/base/compose.scss b/app/assets/stylesheets/common/base/compose.scssindex c5be8d42fa1..81e5cc54697 100644--- a/app/assets/stylesheets/common/base/compose.scss+++ b/app/assets/stylesheets/common/base/compose.scss@@ -200,29 +200,6 @@ html.composer-open:not(.has-full-page-chat) {justify-content: space-between;}- .reply-details {- flex: 1;- display: flex;- align-items: center;- min-width: 0;- white-space: nowrap;- gap: var(--space-2);-- .composer-actions {- .select-kit-header {- border-color: var(--primary-low-mid);- }-- .d-icon {- color: var(--primary-medium);- }- }-- @include viewport.until(sm) {- max-width: calc(100% - 75px);- }- }-.composer-actions-trigger {border-color: var(--input-border-color);}@@ -305,20 +282,12 @@ html.composer-open:not(.has-full-page-chat) {// has no effect on most users but we need it for some cases. If this is// not added, "add edit reason" will overlap with the composer controls@include viewport.until(sm) {- .reply-details {- flex-wrap: wrap;- }-.composer-actions-reply-target-link {.d-icon {margin-right: none;}}- .display-edit-reason.--active {- width: 100%;- }-#edit-reason {width: 100%;margin-left: 0;@@ -327,28 +296,6 @@ html.composer-open:not(.has-full-page-chat) {}}- .whisper,- .display-edit-reason {- font-style: italic;- }-- .whisper {- margin: 0 0.25em;- }-- .unlist {- margin-left: 0.25em;- }-- .display-edit-reason {- display: inline-flex;- margin-left: auto;-- a {- display: inline-flex;- }- }-#edit-reason {margin: 0 4px;}diff --git a/app/assets/stylesheets/common/select-kit/_index.scss b/app/assets/stylesheets/common/select-kit/_index.scssindex 43f24bbd518..7c5a4f074c1 100644--- a/app/assets/stylesheets/common/select-kit/_index.scss+++ b/app/assets/stylesheets/common/select-kit/_index.scss@@ -6,7 +6,6 @@@import "color-palettes";@import "color-palette-picker";@import "combo-box";-@import "composer-actions";@import "dropdown-select-box";@import "email-group-user-chooser";@import "flair-row";diff --git a/app/assets/stylesheets/common/select-kit/composer-actions.scss b/app/assets/stylesheets/common/select-kit/composer-actions.scssdeleted file mode 100644index 3b7506cef82..00000000000--- a/app/assets/stylesheets/common/select-kit/composer-actions.scss+++ /dev/null@@ -1,29 +0,0 @@-.select-kit {- &.dropdown-select-box {- &.composer-actions {- margin: 0;-- .select-kit-header {- background: none;- outline: none;- padding: 0;- margin-right: 8px;- border: 1px solid var(--primary-medium);- min-height: unset;-- .d-icon {- padding: 5px 6px;- }-- &:hover,- &:focus {- background: var(--primary-low);- }- }-- .d-icon {- margin: 0 !important;- }- }- }-}diff --git a/app/assets/stylesheets/wcag.scss b/app/assets/stylesheets/wcag.scssindex 1ac293d3342..be35b72235a 100644--- a/app/assets/stylesheets/wcag.scss+++ b/app/assets/stylesheets/wcag.scss@@ -44,12 +44,6 @@ html {color: var(--primary);}- // Composer- #reply-control .reply-to .reply-details .d-icon {- opacity: 1;- color: var(--primary-low-mid);- }-.d-editor-button-bar {.btn-icon.btn-default .d-icon {color: var(--primary-low-mid);diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex baabec23889..350458fdd85 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -2948,7 +2948,6 @@ en:enable_new_checkbox_style: "Enable the redesigned checkbox style for FormKit checkboxes."enable_new_post_reactions_menu: "Enable the redesigned post likes and reactions menu, with infinite scroll and a native mobile experience."enable_composer_redesign: "Enable the redesigned composer."- enable_new_composer_actions: "Enable the redesigned composer actions menu and combo save button, with whisper, no-bump, and unlist toggles surfaced next to the save action."prioritize_recently_used_tags: "When adding tags while creating or editing a topic, show the tags the member has recently used on their own topics at the top of the list, before the most popular tags of the forum."experimental_impersonation_time_limit_minutes: "How long before an impersonation session is automatically ended."page_loading_indicator: "Configure the loading indicator which appears during page navigations within Discourse. 'Spinner' is a full page indicator. 'Slider' shows a narrow bar at the top of the screen."diff --git a/config/site_settings.yml b/config/site_settings.ymlindex f8e1885ab8a..f6063693e82 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -4714,15 +4714,6 @@ experimental:impact: "other,all_members"body_class: truelearn_more_url: "https://meta.discourse.org/t/-/407849"- enable_new_composer_actions:- default: false- client: true- hidden: true- area: "experimental"- upcoming_change:- status: "permanent"- impact: "feature,all_members"- learn_more_url: "https://meta.discourse.org/t/-/403635"prioritize_recently_used_tags:default: falseclient: truediff --git a/db/post_migrate/20260813202233_remove_enable_new_composer_actions_setting.rb b/db/post_migrate/20260813202233_remove_enable_new_composer_actions_setting.rbnew file mode 100644index 00000000000..89dc655ed8d--- /dev/null+++ b/db/post_migrate/20260813202233_remove_enable_new_composer_actions_setting.rb@@ -0,0 +1,10 @@+# frozen_string_literal: true+class RemoveEnableNewComposerActionsSetting < ActiveRecord::Migration[8.0]+ def up+ execute "DELETE FROM site_settings WHERE name = 'enable_new_composer_actions'"+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+enddiff --git a/db/structure.sql b/db/structure.sqlindex 7d0fa754a95..6d1d73db5bb 100644--- a/db/structure.sql+++ b/db/structure.sql@@ -23175,6 +23175,7 @@ INSERT INTO "schema_migrations" (version) VALUES('20260814083721'),('20260814060100'),('20260814060000'),+('20260813202233'),('20260812094609'),('20260811231259'),('20260810154331'),diff --git a/frontend/discourse/app/components/composer-action-title.gjs b/frontend/discourse/app/components/composer-action-title.gjsindex df6881f5bb6..0c2c3364e44 100644--- a/frontend/discourse/app/components/composer-action-title.gjs+++ b/frontend/discourse/app/components/composer-action-title.gjs@@ -1,65 +1,28 @@/* eslint-disable ember/no-classic-components */import Component from "@ember/component";-import { hash } from "@ember/helper";-import { on } from "@ember/modifier";-import { action, computed, set } from "@ember/object";+import { action, computed } from "@ember/object";import { service } from "@ember/service";import { trustHTML } from "@ember/template";import { tagName } from "@ember-decorators/component";-import ComposerActionsNew from "discourse/components/composer-actions-new";+import ComposerActions from "discourse/components/composer-actions";import escape from "discourse/lib/escape";import { iconHTML } from "discourse/lib/icon-library";-import {- ADD_TRANSLATION,- CREATE_SHARED_DRAFT,- CREATE_TOPIC,- EDIT,- EDIT_SHARED_DRAFT,- PRIVATE_MESSAGE,- REPLY,-} from "discourse/models/composer";-import ComposerActionsOld from "discourse/select-kit/components/composer-actions";+import { EDIT } from "discourse/models/composer";import DButton from "discourse/ui-kit/d-button";-import { i18n } from "discourse-i18n";--const TITLES = {- [PRIVATE_MESSAGE]: "topic.private_message",- [CREATE_TOPIC]: "topic.create_long",- [CREATE_SHARED_DRAFT]: "composer.create_shared_draft",- [EDIT_SHARED_DRAFT]: "composer.edit_shared_draft",- [ADD_TRANSLATION]: "composer.translations.title",-};@tagName("")export default class ComposerActionTitle extends Component {- // Note we update when some other attributes like tag/category change to allow- // text customizations to use those.-@service composer;- @service siteSettings;@computed("model.replyOptions")get options() {return this.model?.replyOptions;}- set options(value) {- set(this, "model.replyOptions", value);- }-- @computed("model.action")- get action() {- return this.model?.action;- }-- set action(value) {- set(this, "model.action", value);- }-- @computed("action", "model.post.can_edit", "model.topic")+ @computed("model.action", "model.post.can_edit", "model.topic")get canEditReplyTo() {return (- this.action === EDIT &&+ this.model?.action === EDIT &&!!this.model?.post?.can_edit &&!!this.model?.topic);@@ -70,43 +33,6 @@ export default class ComposerActionTitle extends Component {this.composer.openChangeReplyToModal();}- @computed("options", "action", "model.tags", "model.category")- get actionTitle() {- const result = this.model.customizationFor("actionTitle");- if (result) {- return result;- }-- if (TITLES[this.action]) {- return i18n(TITLES[this.action]);- }-- if (this.action === REPLY) {- if (this.options.userAvatar && this.options.userLink) {- return this._formatReplyToUserPost(- this.options.userAvatar,- this.options.userLink- );- } else if (this.options.topicLink) {- return this._formatReplyToTopic(this.options.topicLink);- }- }-- if (this.action === EDIT) {- if (- this.options.userAvatar &&- this.options.userLink &&- this.options.postLink- ) {- return this._formatEditUserPost(- this.options.userAvatar,- this.options.userLink,- this.options.postLink- );- }- }- }-@computed("options.originalUser")get replyTargetSegment() {const originalUser = this.options?.originalUser;@@ -120,87 +46,30 @@ export default class ComposerActionTitle extends Component {);}- _formatEditUserPost(userAvatar, userLink, postLink) {- return trustHTML(`- <a class="post-link" href="${postLink.href}">${postLink.anchor}</a>- ${userAvatar}- <span class="username">${escape(userLink.anchor)}</span>- `);- }-- _formatReplyToTopic(link) {- return trustHTML(- `<a class="topic-link" href="${link.href}" data-topic-id="${this.get(- "model.topic.id"- )}">${link.anchor}</a>`- );- }-- _formatReplyToUserPost(avatar, link) {- const htmlLink = `<a class="user-link" href="${link.href}">${escape(- link.anchor- )}</a>`;- return trustHTML(`${avatar}${htmlLink}`);- }-<template><div class="composer-action-title" ...attributes>- {{#if this.siteSettings.enable_new_composer_actions}}- <span class="action-title" role="heading" aria-level="1">- <ComposerActionsNew- @composerModel={{this.model}}- @replyOptions={{this.model.replyOptions}}- @action={{this.model.action}}- @tabindex={{this.tabindex}}- @topic={{this.model.topic}}- @post={{this.model.post}}- @options={{hash mobilePlacementStrategy="fixed"}}- />-- {{#if this.replyTargetSegment}}- {{#if this.canEditReplyTo}}- <DButton- @action={{this.openChangeReplyToModal}}- @title="composer.change_reply_to.open"- @translatedLabel={{this.replyTargetSegment}}- class="composer-edit-reply-to btn-default"- />- {{else}}- {{this.replyTargetSegment}}- {{/if}}- {{/if}}- </span>- {{else}}- <ComposerActionsOld+ <span class="action-title" role="heading" aria-level="1">+ <ComposerActions@composerModel={{this.model}}@replyOptions={{this.model.replyOptions}}- @canWhisper={{this.canWhisper}}- @canUnlistTopic={{this.canUnlistTopic}}@action={{this.model.action}}- @tabindex={{this.tabindex}}@topic={{this.model.topic}}@post={{this.model.post}}- @whisper={{this.model.whisper}}- @noBump={{this.model.noBump}}- @options={{hash mobilePlacementStrategy="fixed"}}/>- <span class="action-title" role="heading" aria-level="1">- {{this.actionTitle}}- {{#if this.replyTargetSegment}}- {{#if this.canEditReplyTo}}- <button- type="button"- class="composer-edit-reply-to"- title={{i18n "composer.change_reply_to.open"}}- {{on "click" this.openChangeReplyToModal}}- >{{this.replyTargetSegment}}</button>- {{else}}- {{this.replyTargetSegment}}- {{/if}}+ {{#if this.replyTargetSegment}}+ {{#if this.canEditReplyTo}}+ <DButton+ @action={{this.openChangeReplyToModal}}+ @title="composer.change_reply_to.open"+ @translatedLabel={{this.replyTargetSegment}}+ class="composer-edit-reply-to btn-default"+ />+ {{else}}+ {{this.replyTargetSegment}}{{/if}}- </span>- {{/if}}+ {{/if}}+ </span></div></template>}diff --git a/frontend/discourse/app/components/composer-actions-new.gjs b/frontend/discourse/app/components/composer-actions.gjssimilarity index 99%rename from frontend/discourse/app/components/composer-actions-new.gjsrename to frontend/discourse/app/components/composer-actions.gjsindex 9a52dbb1e00..b19f4d95c60 100644--- a/frontend/discourse/app/components/composer-actions-new.gjs+++ b/frontend/discourse/app/components/composer-actions.gjs@@ -7,6 +7,7 @@ import { action, get } from "@ember/object";import { service } from "@ember/service";import DMenu from "discourse/float-kit/components/d-menu";import { ComposerActionItemBuilder } from "discourse/lib/composer/action-items";+import { registeredComposerActions } from "discourse/lib/composer/actions-registry";import { prioritizeNameFallback } from "discourse/lib/settings";import {applyBehaviorTransformer,@@ -21,7 +22,6 @@ import {PRIVATE_MESSAGE,REPLY,} from "discourse/models/composer";-import { registeredComposerActions } from "discourse/select-kit/components/composer-actions";import { or } from "discourse/truth-helpers";import DButton from "discourse/ui-kit/d-button";import DDropdownMenu from "discourse/ui-kit/d-dropdown-menu";@@ -443,7 +443,7 @@ export default class ComposerActions extends Component {@onRegisterApi={{this.registerDmenuApi}}@triggerClass="composer-actions-trigger btn-flat btn-icon-text"@contentClass="composer-actions-dropdown"- class="composer-actions-new"+ class="composer-actions"><:trigger>{{dIcon "angle-down" class="composer-actions-caret"}}diff --git a/frontend/discourse/app/components/composer-container.gjs b/frontend/discourse/app/components/composer-container.gjsindex 8fcc489415b..f14aa92a37c 100644--- a/frontend/discourse/app/components/composer-container.gjs+++ b/frontend/discourse/app/components/composer-container.gjs@@ -18,7 +18,6 @@ import ComposerSaveButton from "discourse/components/composer-save-button";import ComposerTitle from "discourse/components/composer-title";import ComposerToggles from "discourse/components/composer-toggles";import ComposerUserSelector from "discourse/components/composer-user-selector";-import LinkToInput from "discourse/components/link-to-input";import PluginOutlet from "discourse/components/plugin-outlet";import htmlClass from "discourse/helpers/html-class";import lazyHash from "discourse/helpers/lazy-hash";@@ -38,7 +37,6 @@ import { or } from "discourse/truth-helpers";import DButton from "discourse/ui-kit/d-button";import DPopupInputTip from "discourse/ui-kit/d-popup-input-tip";import DResizeSeparator from "discourse/ui-kit/d-resize-separator";-import DTextField from "discourse/ui-kit/d-text-field";import dAvatar from "discourse/ui-kit/helpers/d-avatar";import dConcatClass from "discourse/ui-kit/helpers/d-concat-class";import dIcon from "discourse/ui-kit/helpers/d-icon";@@ -367,98 +365,31 @@ export default class ComposerContainer extends Component {<div class="reply-to">{{#unless this.composer.model.viewFullscreen}}- {{#if this.siteSettings.enable_new_composer_actions}}- <ComposerActionTitle- @model={{this.composer.model}}- @canWhisper={{this.composer.canWhisper}}- @canUnlistTopic={{this.composer.canUnlistTopic}}+ <ComposerActionTitle @model={{this.composer.model}} />++ {{#if this.composer.showTranslationSelector}}+ <DropdownSelectBox+ @nameProperty="name"+ @valueProperty="value"+ @value={{this.composer.selectedTranslationLocale}}+ @content={{this.availableContentLocalizationLocales}}+ @onChange={{this.updateSelectedTranslationLocale}}+ @options={{hash+ icon="language"+ showCaret=true+ filterable=true+ disabled=this.composer.loading+ placement="bottom-start"+ translatedNone=(i18n "composer.translations.select")+ }}+ class="translation-selector-dropdown btn-small"/>-- {{#if this.composer.showTranslationSelector}}- <DropdownSelectBox- @nameProperty="name"- @valueProperty="value"- @value={{this.composer.selectedTranslationLocale}}- @content={{this.availableContentLocalizationLocales}}- @onChange={{this.updateSelectedTranslationLocale}}- @options={{hash- icon="language"- showCaret=true- filterable=true- disabled=this.composer.loading- placement="bottom-start"- translatedNone=(i18n "composer.translations.select")- }}- class="translation-selector-dropdown btn-small"- />- {{/if}}-- <PluginOutlet- @name="composer-action-after"- @outletArgs={{lazyHash model=this.composer.model}}- />- {{else}}- <div class="reply-details">- <ComposerActionTitle- @model={{this.composer.model}}- @canWhisper={{this.composer.canWhisper}}- @canUnlistTopic={{this.composer.canUnlistTopic}}- />-- {{#if this.composer.showTranslationSelector}}- <DropdownSelectBox- @nameProperty="name"- @valueProperty="value"- @value={{this.composer.selectedTranslationLocale}}- @content={{this.availableContentLocalizationLocales}}- @onChange={{this.updateSelectedTranslationLocale}}- @options={{hash- icon="language"- showCaret=true- filterable=true- disabled=this.composer.loading- placement="bottom-start"- translatedNone=(i18n "composer.translations.select")- }}- class="translation-selector-dropdown btn-small"- />- {{/if}}-- <PluginOutlet- @name="composer-action-after"- @outletArgs={{lazyHash model=this.composer.model}}- />-- {{#if this.site.desktopView}}- {{#if this.composer.model.unlistTopic}}- <span class="unlist">({{i18n "composer.unlist"}})</span>- {{/if}}- {{#if this.composer.isWhispering}}- {{#if this.composer.model.noBump}}- <span class="no-bump">{{dIcon "anchor"}}</span>- {{/if}}- {{/if}}- {{/if}}-- {{#if this.composer.canEdit}}- <LinkToInput- @onClick={{this.composer.displayEditReason}}- @showInput={{this.composer.showEditReason}}- @icon="pen-to-square"- class="display-edit-reason- {{if this.composer.showEditReason '--active'}}"- title={{i18n "composer.edit_reason"}}- >- <DTextField- @value={{this.composer.editReason}}- @id="edit-reason"- @maxlength="255"- @placeholderKey="composer.edit_reason_placeholder"- />- </LinkToInput>- {{/if}}- </div>{{/if}}++ <PluginOutlet+ @name="composer-action-after"+ @outletArgs={{lazyHash model=this.composer.model}}+ />{{/unless}}<PluginOutletdiff --git a/frontend/discourse/app/components/link-to-input.gjs b/frontend/discourse/app/components/link-to-input.gjsdeleted file mode 100644index 95fef00f631..00000000000--- a/frontend/discourse/app/components/link-to-input.gjs+++ /dev/null@@ -1,34 +0,0 @@-/* eslint-disable ember/no-classic-components, ember/require-tagless-components */-import Component from "@ember/component";-import { schedule } from "@ember/runloop";-import dIcon from "discourse/ui-kit/helpers/d-icon";-import { i18n } from "discourse-i18n";--export default class LinkToInput extends Component {- showInput = false;-- click() {- this.onClick();-- schedule("afterRender", () => {- this.element.querySelector("input").focus();- });-- return false;- }-- <template>- {{#if this.showInput}}- {{yield}}- {{else}}- <a href>- {{#if this.key}}- {{i18n this.key}}- {{/if}}- {{#if this.icon}}- {{dIcon this.icon}}- {{/if}}- </a>- {{/if}}- </template>-}diff --git a/frontend/discourse/app/lib/composer/actions-registry.js b/frontend/discourse/app/lib/composer/actions-registry.jsnew file mode 100644index 00000000000..804ec2c22d5--- /dev/null+++ b/frontend/discourse/app/lib/composer/actions-registry.js@@ -0,0 +1,13 @@+let registeredActions = [];++export function registerComposerAction(opts) {+ registeredActions.push(opts);+}++export function registeredComposerActions() {+ return registeredActions;+}++export function _clearRegisteredActions() {+ registeredActions = [];+}diff --git a/frontend/discourse/app/lib/plugin-api.gjs b/frontend/discourse/app/lib/plugin-api.gjsindex 5c210457d38..92e30e1a221 100644--- a/frontend/discourse/app/lib/plugin-api.gjs+++ b/frontend/discourse/app/lib/plugin-api.gjs@@ -59,6 +59,7 @@ import { _registerOutlet } from "discourse/lib/blocks/-internals/registry/outletimport classPrepend, {withPrependsRolledBack,} from "discourse/lib/class-prepend";+import { registerComposerAction } from "discourse/lib/composer/actions-registry";import { addPopupMenuOption } from "discourse/lib/composer/custom-popup-menu-options";import { registerRichEditorExtension } from "discourse/lib/composer/rich-editor-extensions";import {@@ -142,7 +143,6 @@ import {} from "discourse/models/user";import { preventCloaking } from "discourse/modifiers/post-stream-viewport-tracker";import { setNotificationsLimit } from "discourse/routes/user-notifications";-import { registerComposerAction } from "discourse/select-kit/components/composer-actions";import { CUSTOM_USER_SEARCH_OPTIONS } from "discourse/select-kit/components/user-chooser";import { modifySelectKit } from "discourse/select-kit/lib/plugin-api";import { addComposerSaveErrorCallback } from "discourse/services/composer";diff --git a/frontend/discourse/select-kit/components/composer-actions.js b/frontend/discourse/select-kit/components/composer-actions.jsdeleted file mode 100644index 2ac2d8d694c..00000000000--- a/frontend/discourse/select-kit/components/composer-actions.js+++ /dev/null@@ -1,482 +0,0 @@-import { action, computed } from "@ember/object";-import { service } from "@ember/service";-import { camelize } from "@ember/string";-import { isEmpty } from "@ember/utils";-import { classNames } from "@ember-decorators/component";-import { escapeExpression } from "discourse/lib/utilities";-import {- CREATE_SHARED_DRAFT,- CREATE_TOPIC,- EDIT,- PRIVATE_MESSAGE,- REPLY,-} from "discourse/models/composer";-import Draft from "discourse/models/draft";-import DropdownSelectBoxComponent from "discourse/select-kit/components/dropdown-select-box";-import { i18n } from "discourse-i18n";-import { pluginApiIdentifiers, selectKitOptions } from "./select-kit";--// Component can get destroyed and lose state-let _topicSnapshot = null;-let _postSnapshot = null;-let _actionSnapshot = null;--export function _clearSnapshots() {- _topicSnapshot = null;- _postSnapshot = null;- _actionSnapshot = null;-}--let _registeredActions = [];-let _warnedConditionIds = new Set();--export function registerComposerAction(opts) {- _registeredActions.push(opts);-}--export function registeredComposerActions() {- return _registeredActions;-}--export function _clearRegisteredActions() {- _registeredActions = [];- _warnedConditionIds = new Set();-}--@classNames("composer-actions")-@pluginApiIdentifiers(["composer-actions"])-@selectKitOptions({- icon: "iconForComposerAction",- filterable: false,- showFullTitle: false,- preventHeaderFocus: true,- customStyle: true,- btnCustomClasses: "composer-actions-btn",-})-export default class ComposerActions extends DropdownSelectBoxComponent {- @service dialog;- @service composer;-- seq = 0;-- @computed("action")- get isEditing() {- return this.action === EDIT;- }-- @computed("topic.slow_mode_seconds")- get isInSlowMode() {- return this.topic?.slow_mode_seconds > 0;- }-- @computed("isEditing", "action", "whisper", "noBump", "isInSlowMode")- get iconForComposerAction() {- if (this.action === CREATE_TOPIC) {- return "plus";- } else if (this.action === PRIVATE_MESSAGE) {- return "envelope";- } else if (this.action === CREATE_SHARED_DRAFT) {- return "far-clipboard";- } else if (this.whisper) {- return "far-eye-slash";- } else if (this.noBump) {- return "anchor";- } else if (this.isInSlowMode) {- return "hourglass-start";- } else if (this.isEditing) {- return "pencil";- } else {- return "reply";- }- }-- contentChanged() {- this.set("seq", this.seq + 1);- }-- didReceiveAttrs() {- super.didReceiveAttrs(...arguments);- let changeContent = false;-- // if we change topic we want to change both snapshots- if (- this.topic &&- (!_topicSnapshot || this.topic.id !== _topicSnapshot.id)- ) {- _topicSnapshot = this.topic;- _postSnapshot = this.post;- changeContent = true;- }-- // if we hit reply on a different post we want to change postSnapshot- if (this.post && (!_postSnapshot || this.post.id !== _postSnapshot.id)) {- _postSnapshot = this.post;- changeContent = true;- }-- if (this.action !== _actionSnapshot) {- _actionSnapshot = this.action;- changeContent = true;- }-- if (changeContent) {- this.contentChanged();- }-- this.set("selectKit.isHidden", isEmpty(this.content));- }-- modifySelection() {- return {};- }-- @computed("seq", "composerModel.categoryId", "composerModel.category")- get content() {- let items = [];-- if (- this.action === REPLY &&- this.topic &&- this.topic.isPrivateMessage &&- this.topic.details &&- (this.topic.details.allowed_users.length > 1 ||- this.topic.details.allowed_groups.length > 0) &&- !this.isEditing &&- _topicSnapshot- ) {- items.push({- name: i18n(- "composer.composer_actions.reply_as_new_group_message.label"- ),- description: i18n(- "composer.composer_actions.reply_as_new_group_message.desc"- ),- icon: "plus",- id: "reply_as_new_group_message",- });- }-- if (- this.action === REPLY &&- this.action !== CREATE_TOPIC &&- this.action !== CREATE_SHARED_DRAFT &&- this.topic &&- !this.topic.isPrivateMessage &&- !this.isEditing &&- this.currentUser.can_create_topic &&- _topicSnapshot- ) {- items.push({- name: i18n("composer.composer_actions.reply_as_new_topic.label"),- description: i18n("composer.composer_actions.reply_as_new_topic.desc"),- icon: "plus",- id: "reply_as_new_topic",- });- }-- if (- (this.action !== REPLY && _postSnapshot) ||- (this.action === REPLY &&- _postSnapshot &&- !(this.replyOptions.userAvatar && this.replyOptions.userLink))- ) {- items.push({- name: i18n("composer.composer_actions.reply_to_post.label", {- postUsername: _postSnapshot.username,- }),- description: i18n("composer.composer_actions.reply_to_post.desc"),- icon: "reply",- id: "reply_to_post",- });- }-- if (- !this.isEditing &&- ((this.action !== REPLY && _topicSnapshot) ||- (this.action === REPLY &&- _topicSnapshot &&- this.replyOptions.userAvatar &&- this.replyOptions.userLink &&- this.replyOptions.topicLink))- ) {- items.push({- name: i18n("composer.composer_actions.reply_to_topic.label"),- description: i18n("composer.composer_actions.reply_to_topic.desc"),- icon: "reply",- id: "reply_to_topic",- });- }-- // if answered post is a whisper, we can only answer with a whisper so no need for toggle- if (- this.canWhisper &&- (!this.replyOptions.postLink ||- !_postSnapshot ||- _postSnapshot.post_type !== this.site.post_types.whisper)- ) {- items.push({- name: i18n("composer.composer_actions.toggle_whisper.label"),- description: i18n("composer.composer_actions.toggle_whisper.desc"),- icon: "far-eye-slash",- id: "toggle_whisper",- });- }-- if (this.canUnlistTopic) {- items.push({- name: i18n("composer.composer_actions.toggle_unlisted.label"),- description: i18n("composer.composer_actions.toggle_unlisted.desc"),- icon: "far-eye-slash",- id: "toggle_unlisted",- });- }-- if (this.action === CREATE_TOPIC) {- if (this.site.shared_drafts_category_id) {- // Shared Drafts Choice- items.push({- name: i18n("composer.composer_actions.shared_draft.label"),- description: i18n("composer.composer_actions.shared_draft.desc"),- icon: "far-clipboard",- id: "shared_draft",- });- }- }-- const showToggleTopicBump =- this.get("currentUser.staff") ||- this.get("currentUser.trust_level") === 4;-- if (this.action === REPLY && showToggleTopicBump) {- items.push({- name: i18n("composer.composer_actions.toggle_topic_bump.label"),- description: i18n("composer.composer_actions.toggle_topic_bump.desc"),- icon: "anchor",- id: "toggle_topic_bump",- });- }-- if (- this.currentUser.can_create_topic &&- this.action !== CREATE_TOPIC &&- (items.length === 0 || this.action === PRIVATE_MESSAGE)- ) {- items.push({- name: i18n("composer.composer_actions.create_topic.label"),- description: i18n("composer.composer_actions.create_topic.desc"),- icon: "share",- id: "create_topic",- });- }-- if (- this.currentUser.can_send_private_messages &&- this.action !== PRIVATE_MESSAGE &&- this.action !== REPLY &&- !this.isEditing- ) {- items.push({- name: i18n("composer.composer_actions.create_personal_message.label"),- description: i18n(- "composer.composer_actions.create_personal_message.desc"- ),- icon: "envelope",- id: "create_private_message",- });- }-- _registeredActions.forEach((opts) => {- let visible = true;- if (opts.condition) {- try {- visible = !!opts.condition(this);- } catch (e) {- if (!_warnedConditionIds.has(opts.id)) {- _warnedConditionIds.add(opts.id);- // eslint-disable-next-line no-console- console.error(- `composer-actions: condition for "${opts.id}" threw`,- e- );- }- visible = false;- }- }- if (!visible) {- return;- }- items.push({- id: opts.id,- name: i18n(opts.label),- description: opts.description ? i18n(opts.description) : undefined,- icon: opts.icon,- });- });-- return items;- }-- _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})`;- return i18n("post.continue_discussion", {- postLink: link,- });- }-- async _replyFromExisting(options, post, topic) {- await this.composer.destroyDraft();- this.composer.close();- await this.composer.open({- ...options,- prependText: this._continuedFromText(post, topic),- });- }-- _openComposer(options) {- this.composer.closeComposer();- this.composer.open(options);- }-- toggleWhisperSelected(options, model) {- model.toggleProperty("whisper");- }-- toggleUnlistedSelected(options, model) {- model.toggleProperty("unlistTopic");- }-- toggleTopicBumpSelected(options, model) {- 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";-- this._replyFromExisting(options, _postSnapshot, _topicSnapshot);- }-- replyToTopicSelected(options) {- options.action = REPLY;- options.topic = _topicSnapshot;- this._openComposer(options);- }-- replyToPostSelected(options) {- options.action = REPLY;- options.post = _postSnapshot;- this._openComposer(options);- }-- replyAsNewTopicSelected(options) {- Draft.get("new_topic").then((response) => {- if (response.draft) {- this.dialog.confirm({- message: i18n("composer.composer_actions.reply_as_new_topic.confirm"),- confirmButtonLabel: "composer.ok_proceed",- didConfirm: () => this._replyAsNewTopicSelect(options),- });- } else {- this._replyAsNewTopicSelect(options);- }- });- }-- _replyAsNewTopicSelect(options) {- options.action = CREATE_TOPIC;- options.draftKey = this.composer.topicDraftKey;- options.categoryId = this.get("composerModel.topic.category.id");- options.disableScopedCategory = true;- this._replyFromExisting(options, _postSnapshot, _topicSnapshot);- }-- replyAsPrivateMessageSelected(options) {- let usernames;-- if (_postSnapshot && !_postSnapshot.get("yours")) {- const postUsername = _postSnapshot.get("username");- if (postUsername) {- usernames = postUsername;- }- } else if (this.get("composerModel.topic")) {- const stream = this.get("composerModel.topic.postStream");-- if (stream.get("firstPostPresent")) {- const post = stream.posts[0];- if (post && !post.get("yours") && post.get("username")) {- usernames = post.get("username");- }- }- }-- options.action = PRIVATE_MESSAGE;- options.recipients = usernames;- options.archetypeId = "private_message";-- this._replyFromExisting(options, _postSnapshot, _topicSnapshot);- }-- _switchCreate(options, composerAction) {- options.action = composerAction;- options.categoryId = this.get("composerModel.categoryId");- options.topicTitle = this.get("composerModel.title");- options.tags = this.get("composerModel.tags");- this._openComposer(options);- }-- createTopicSelected(options) {- this._switchCreate(options, CREATE_TOPIC);- }-- sharedDraftSelected(options) {- this._switchCreate(options, CREATE_SHARED_DRAFT);- }-- createPrivateMessageSelected(options) {- options.archetypeId = "private_message";- this._switchCreate(options, PRIVATE_MESSAGE);- }-- @action- onChange(value) {- const registered = _registeredActions.find((a) => a.id === value);- if (registered) {- registered.action(this.composerModel, this);- this.contentChanged();- return;- }-- 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`);- }- }-}diff --git a/frontend/discourse/tests/acceptance/composer-actions-new-test.js b/frontend/discourse/tests/acceptance/composer-actions-new-test.jsdeleted file mode 100644index 1873c14c111..00000000000--- a/frontend/discourse/tests/acceptance/composer-actions-new-test.js+++ /dev/null@@ -1,707 +0,0 @@-import { click, fillIn, visit, waitFor } from "@ember/test-helpers";-import { test } from "qunit";-import sinon from "sinon";-import { cloneJSON } from "discourse/lib/object";-import Draft from "discourse/models/draft";-import discoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";-import topicFixtures from "discourse/tests/fixtures/topic";-import userFixtures from "discourse/tests/fixtures/user-fixtures";-import {- acceptance,- selectText,- updateCurrentUser,-} from "discourse/tests/helpers/qunit-helpers";-import selectKit from "discourse/tests/helpers/select-kit-helper";-import { i18n } from "discourse-i18n";--function composerActionsDropdown() {- return {- async expand() {- await click(".composer-actions-trigger");- },- async selectRowByValue(value) {- await click(`[data-action-id='${value}']`);- },- rows() {- return document.querySelectorAll(- ".composer-actions-dropdown [data-action-id]"- );- },- actionIds() {- return [...this.rows()].map((row) => row.dataset.actionId);- },- };-}--acceptance(`Composer Actions (new composer actions)`, function (needs) {- needs.user({- id: 5,- username: "kris",- whisperer: true,- });- needs.settings({- prioritize_username_in_ux: true,- display_name_on_posts: false,- enable_new_composer_actions: true,- });- needs.site({ can_tag_topics: true });- needs.pretender((server, helper) => {- server.put("/u/kris.json", () => helper.response({ user: {} }));- const cardResponse = cloneJSON(userFixtures["/u/shade/card.json"]);- server.get("/u/shade/card.json", () => helper.response(cardResponse));- server.get("/c/shared-drafts/24/l/latest.json", () => {- const response = cloneJSON(discoveryFixtures["/c/bug/1/l/latest.json"]);- response.topic_list.can_create_topic = true;- response.topic_list.filter = "c/shared-drafts/24/l/latest";-- return helper.response(response);- });- server.get("/t/54077.json", () => {- const response = cloneJSON(topicFixtures["/t/54077.json"]);- response.fancy_title =- '<span dir="auto">Short topic with two posts</span>';-- return helper.response(response);- });- });-- test("replying to post", async function (assert) {- const composerActions = composerActionsDropdown();-- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");- await composerActions.expand();-- assert.deepEqual(composerActions.actionIds().sort(), [- "reply_as_new_topic",- "reply_to_topic",- ]);- });-- test("replying to post - reply_to_topic", async function (assert) {- const composerActions = composerActionsDropdown();-- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");- await fillIn(- ".d-editor-input",- "test replying to topic when initially replied to post"- );-- await composerActions.expand();- await composerActions.selectRowByValue("reply_to_topic");-- assert- .dom(".composer-actions-trigger")- .includesText(i18n("composer.composer_actions.reply_to_topic.trigger"));- assert- .dom(".d-editor-input")- .hasValue("test replying to topic when initially replied to post");- });-- test("toggle whisper via actions dropdown for whisperers", async function (assert) {- updateCurrentUser({ admin: false, moderator: false });-- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");-- await click(".composer-actions-trigger");-- assert- .dom(".composer-toggle-whisper")- .exists("whisper toggle item is visible in dropdown");-- await click(".composer-toggle-whisper .d-toggle-switch__checkbox");-- assert- .dom(- ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='true']"- )- .exists("whisper toggle is on after click");-- await click(".composer-toggle-whisper .d-toggle-switch__checkbox");-- assert- .dom(- ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='false']"- )- .exists("whisper toggle is off after second click");- });-- test("replying to post - reply_as_new_topic", async function (assert) {- sinon.stub(Draft, "get").resolves({ draft: "", draft_sequence: 0 });-- const composerActions = composerActionsDropdown();- const categoryChooser = selectKit(".title-wrapper .category-chooser");- const categoryChooserReplyArea = selectKit(".reply-area .category-chooser");- const quote = "test replying as new topic when initially replied to post";-- await visit("/t/internationalization-localization/280");-- await click("#topic-title .d-icon-pencil");- await categoryChooser.expand();- await categoryChooser.selectRowByValue(4);- await click("#topic-title .submit-edit");-- await click("article#post_3 button.reply");- await fillIn(".d-editor-input", quote);-- await composerActions.expand();- await composerActions.selectRowByValue("reply_as_new_topic");-- assert.strictEqual(categoryChooserReplyArea.header().name(), "faq");- assert.dom(".d-editor-input").includesValue(quote);- });-- test("reply_as_new_topic without a new_topic draft", async function (assert) {- await visit("/t/internationalization-localization/280");- await click(".create.reply");- const composerActions = composerActionsDropdown();- await composerActions.expand();- await composerActions.selectRowByValue("reply_as_new_topic");- assert.dom(".dialog-body").doesNotExist();- });-- test("reply_as_new_group_message", async function (assert) {- await visit("/t/lorem-ipsum-dolor-sit-amet/130");- await click(".create.reply");- const composerActions = composerActionsDropdown();- await composerActions.expand();- await composerActions.selectRowByValue("reply_as_new_group_message");-- const privateMessageUsers = selectKit("#private-message-users");- assert.deepEqual(privateMessageUsers.header().value(), "foo,foo_group");- });-- test("reply_as_new_topic without a permission to create topic", async function (assert) {- updateCurrentUser({ can_create_topic: false });- await visit("/t/internationalization-localization/280");- await click(".create.reply");- const composerActions = composerActionsDropdown();- await composerActions.expand();- assert- .dom(".composer-actions-dropdown [data-action-id='reply_as_new_topic']")- .doesNotExist("reply as new topic option is not visible");- });-- test("interactions", async function (assert) {- const composerActions = composerActionsDropdown();- const quote = "Life is like riding a bicycle.";-- await visit("/t/short-topic-with-two-posts/54077");- await click("article#post_2 button.reply");- await fillIn(".d-editor-input", quote);- await composerActions.expand();- await composerActions.selectRowByValue("reply_to_topic");-- assert- .dom(".composer-actions-trigger")- .includesText(i18n("composer.composer_actions.reply_to_topic.trigger"));- assert.dom(".d-editor-input").hasValue(quote);-- await composerActions.expand();-- assert.deepEqual(composerActions.actionIds().sort(), [- "reply_as_new_topic",- "reply_to_post",- ]);-- await composerActions.selectRowByValue("reply_to_post");- await composerActions.expand();-- assert.dom(".composer-actions-trigger").includesText("tms");- assert.dom(".d-editor-input").hasValue(quote);- assert.deepEqual(composerActions.actionIds().sort(), [- "reply_as_new_topic",- "reply_to_topic",- ]);-- await composerActions.selectRowByValue("reply_as_new_topic");- await composerActions.expand();-- assert.dom(".d-editor-input").includesValue(quote);- assert.deepEqual(composerActions.actionIds().sort(), [- "create_private_message",- "reply_to_post",- "reply_to_topic",- "shared_draft",- ]);- });-- test("interactions - private message", async function (assert) {- const composerActions = composerActionsDropdown();-- await visit("/t/internationalization-localization/280");- await click('#post_4 a[data-user-card="shade"]');- await click(".usercard-controls .compose-pm .btn-primary");- await composerActions.expand();-- assert.deepEqual(composerActions.actionIds().sort(), ["create_topic"]);- });-- test("reply target link uses plain topic title when fancy title includes HTML", async function (assert) {- await visit("/t/short-topic-with-two-posts/54077");- await click(".create.reply");-- await visit("/");- await waitFor(".composer-actions-reply-target-link__label");-- assert- .dom(".composer-actions-reply-target-link__label")- .hasText(- "Short topic with two posts",- "renders the plain topic title in the reply target link"- );- });-- test("toggle no-bump via actions dropdown", async function (assert) {- await visit("/t/short-topic-with-two-posts/54077");- await click("article#post_2 button.reply");-- await click(".composer-actions-trigger");-- assert- .dom(".composer-toggle-no-bump")- .exists("no-bump toggle item is visible in dropdown");-- await click(".composer-toggle-no-bump .d-toggle-switch__checkbox");-- assert- .dom(- ".composer-toggle-no-bump .d-toggle-switch__checkbox[aria-checked='true']"- )- .exists("no-bump toggle is on after click");-- await click(".composer-toggle-no-bump .d-toggle-switch__checkbox");-- assert- .dom(- ".composer-toggle-no-bump .d-toggle-switch__checkbox[aria-checked='false']"- )- .exists("no-bump toggle is off after second click");- });-- test("replying to post as staff shows whisper + no-bump toggles in dropdown", async function (assert) {- updateCurrentUser({ admin: true });- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");-- await click(".composer-actions-trigger");-- assert- .dom(".composer-toggle-whisper")- .exists("whisper toggle is visible for staff");- assert- .dom(".composer-toggle-no-bump")- .exists("no-bump toggle is visible for staff");- });-- test("replying to post as TL3 user shows no toggles in dropdown", async function (assert) {- updateCurrentUser({- moderator: false,- admin: false,- trust_level: 3,- whisperer: false,- groups: [{ id: 13, name: "tl3_group" }],- });- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");-- await click(".composer-actions-trigger");-- assert- .dom(".composer-toggle-whisper")- .doesNotExist("whisper toggle is not visible for TL3 non-whisperer");- assert- .dom(".composer-toggle-no-bump")- .doesNotExist("no-bump toggle is not visible for TL3 non-whisperer");- });-- test("replying to post as TL4 user shows no-bump toggle in dropdown", async function (assert) {- updateCurrentUser({- moderator: false,- admin: false,- trust_level: 4,- whisperer: false,- groups: [{ id: 13, name: "tl4_group" }],- });- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");-- await click(".composer-actions-trigger");-- assert- .dom(".composer-toggle-no-bump")- .exists("no-bump toggle is visible for TL4");- });-- test("editing post", async function (assert) {- const composerActions = composerActionsDropdown();-- await visit("/t/internationalization-localization/280");- await click("article#post_1 button.show-more-actions");- await click("article#post_1 button.edit");- await composerActions.expand();-- assert.deepEqual(- composerActions.actionIds(),- [],- "no switch actions are offered while editing a post"- );- });-- test("trigger shows correct icon for reply mode", async function (assert) {- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");-- assert- .dom(".composer-actions-trigger svg.d-icon-share")- .exists("shows share icon when replying");- });-- test("trigger shows correct icon for create topic mode", async function (assert) {- await visit("/");- await click("#create-topic");-- assert- .dom(".composer-actions-trigger svg.d-icon-far-pen-to-square")- .exists("shows pen-to-square icon when creating topic");- });-- test("trigger shows correct icon for editing", async function (assert) {- await visit("/t/internationalization-localization/280");- await click("article#post_1 button.show-more-actions");- await click("article#post_1 button.edit");-- assert- .dom(".composer-actions-trigger svg.d-icon-pencil")- .exists("shows pencil icon when editing");- });-- test("trigger shows correct label for reply mode", async function (assert) {- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");-- assert- .dom(".composer-actions-trigger")- .includesText("codinghorror", "shows reply to post label");- });-- test("trigger shows the private message label when replying in a PM", async function (assert) {- await visit("/t/lorem-ipsum-dolor-sit-amet/130");- await click(".create.reply");-- assert- .dom(".composer-actions-trigger")- .includesText(- i18n("composer.composer_actions.reply_to_message.trigger"),- "shows the private message reply label, not the topic label"- );- });-- test("trigger shows correct label for create topic mode", async function (assert) {- await visit("/");- await click("#create-topic");-- assert- .dom(".composer-actions-trigger")- .includesText(- i18n("composer.composer_actions.create_topic.label"),- "shows create topic label"- );- });-- test("create topic mode shows correct actions and unlisted toggle", async function (assert) {- const composer = this.owner.lookup("service:composer");- const composerActions = composerActionsDropdown();- updateCurrentUser({ admin: true });-- await visit("/");- await click("#create-topic");- await composerActions.expand();-- assert- .dom(- ".composer-actions-dropdown [data-action-id='create_private_message']"- )- .exists("shows create private message action");-- assert- .dom(".composer-toggle-unlisted")- .exists("unlisted toggle is visible for staff in create topic mode");-- await click(".composer-toggle-unlisted .d-toggle-switch__checkbox");- composer.model.set("noBump", true);-- assert- .dom(- ".composer-toggle-unlisted .d-toggle-switch__checkbox[aria-checked='true']"- )- .exists("unlisted toggle is on after click");-- await composerActions.selectRowByValue("create_private_message");-- assert.false(- composer.model.unlistTopic,- "unlisted state is cleared when switching to a private message"- );- assert.false(- composer.model.noBump,- "no-bump state is cleared when switching to a private message"- );-- await composerActions.expand();- assert- .dom(".composer-toggle-unlisted")- .doesNotExist("unlisted toggle is not shown in private message mode");- });-- test("create topic mode does not show reply_as_new_topic", async function (assert) {- const composerActions = composerActionsDropdown();-- await visit("/");- await click("#create-topic");- await composerActions.expand();-- assert- .dom(".composer-actions-dropdown [data-action-id='reply_as_new_topic']")- .doesNotExist("does not show reply_as_new_topic in create topic mode");- });-});--function stubDraftResponse() {- sinon.stub(Draft, "get").resolves({- draft:- '{"reply":"dum de dum da ba.","action":"createTopic","title":"dum da ba dum dum","categoryId":null,"archetypeId":"regular","metaData":null,"composerTime":540879,"typingTime":3400}',- draft_sequence: 0,- });-}--acceptance(- `Composer Actions With New Topic Draft (new composer actions)`,- function (needs) {- needs.user({ whisperer: true });-- needs.site({- can_tag_topics: true,- });-- needs.settings({- enable_new_composer_actions: true,- });-- test("shared draft", async function (assert) {- updateCurrentUser({ draft_count: 1 });- stubDraftResponse();-- await visit("/");- await click("button.topic-drafts-menu-trigger");- await waitFor(".topic-drafts-menu-content");- await click(- ".topic-drafts-menu-content .topic-drafts-item:first-child button"- );-- await fillIn(- "#reply-title",- "This is the new text for the title using 'quotes'"- );- await fillIn(".d-editor-input", "This is the new text for the post");-- const tags = selectKit(".mini-tag-chooser");- await tags.expand();- await tags.selectRowByName("monkey");-- const composerActions = composerActionsDropdown();- await composerActions.expand();- await composerActions.selectRowByValue("shared_draft");-- assert.strictEqual(tags.header().name(), "monkey", "tags are not reset");- assert- .dom("#reply-title")- .hasValue("This is the new text for the title using 'quotes'");-- assert- .dom("#reply-control .btn-primary.create .d-button-label")- .hasText(i18n("composer.create_shared_draft"));- assert- .dom(".composer-actions-trigger svg.d-icon-far-clipboard")- .exists("shared draft icon is visible");-- await composerActions.expand();- assert- .dom(".composer-actions-dropdown [data-action-id='create_topic']")- .exists("can switch back to create topic from shared draft mode");- assert- .dom(- ".composer-actions-dropdown [data-action-id='create_private_message']"- )- .exists("can switch to PM from shared draft mode");- });-- test("reply_as_new_topic with new_topic draft", async function (assert) {- await visit("/t/internationalization-localization/280");- await click(".create.reply");-- stubDraftResponse();-- const composerActions = composerActionsDropdown();- await composerActions.expand();- await composerActions.selectRowByValue("reply_as_new_topic");-- assert- .dom(".dialog-body")- .hasText(i18n("composer.composer_actions.reply_as_new_topic.confirm"));- await click(".dialog-footer .btn-primary");-- assert.dom(".d-editor-input").hasValue(/^Continuing the discussion from/);- });- }-);--acceptance(`Prioritize Username (new composer actions)`, function (needs) {- needs.user();- needs.settings({- prioritize_username_in_ux: true,- display_name_on_posts: false,- enable_new_composer_actions: true,- });-- test("Reply to post use username", async function (assert) {- await visit("/t/short-topic-with-two-posts/54079");- await click("article#post_2 button.reply");-- assert.dom(".composer-actions-trigger").includesText("james_john");- });-- test("Quotes use username", async function (assert) {- await visit("/t/short-topic-with-two-posts/54079");- await selectText("#post_2 p");- await click(".insert-quote");- assert- .dom(".d-editor-input")- .hasValue(- '[quote="james_john, post:2, topic:54079, full:true"]\nThis is a short topic.\n[/quote]\n\n'- );- });-});--acceptance(`Prioritize Full Name (new composer actions)`, function (needs) {- needs.user();- needs.settings({- prioritize_username_in_ux: false,- display_name_on_posts: true,- enable_new_composer_actions: true,- });-- test("Reply to post use full name", async function (assert) {- await visit("/t/short-topic-with-two-posts/54079");- await click("article#post_2 button.reply");-- assert- .dom(".composer-actions-trigger")- .includesText("james, john, the third");- });-- test("Quotes use full name", async function (assert) {- await visit("/t/short-topic-with-two-posts/54079");- await selectText("#post_2 p");- await click(".insert-quote");- assert- .dom(".d-editor-input")- .hasValue(- '[quote="james, john, the third, post:2, topic:54079, full:true, username:james_john"]\nThis is a short topic.\n[/quote]\n\n'- );- });-- test("Quoting a nested quote returns the correct username", async function (assert) {- await visit("/t/short-topic-with-two-posts/54079");- await selectText("#post_4 p");- await click(".insert-quote");- assert- .dom(".d-editor-input")- .hasValue(- '[quote="james_john, post:2, topic:54079"]\nThis is a short topic.\n[/quote]\n\n'- );- });-});--acceptance(`Slow Mode (new composer actions)`, function (needs) {- needs.user();- needs.settings({ enable_new_composer_actions: true });- needs.pretender((server, helper) => {- server.get("/t/130.json", () => {- const json = cloneJSON(topicFixtures["/t/130.json"]);- // The 130 fixture is a PM; slow mode only applies to regular topics.- json.archetype = "regular";- json.slow_mode_seconds = 600;- json.slow_mode_enabled_until = "2040-01-01T04:00:00.000Z";- return helper.response(json);- });- });-- test("trigger shows the regular reply label with the slow-mode icon", async function (assert) {- await visit("/t/internationalization-localization/130");- await click("article#post_1 button.reply");-- assert- .dom(".composer-actions-trigger svg.d-icon-hourglass-start")- .exists("uses the slow-mode hourglass icon");- assert- .dom(".composer-actions-trigger")- .includesText(- i18n("composer.composer_actions.reply_to_topic.trigger"),- "falls back to the standard reply-to-topic trigger label"- );- });-});--acceptance(`Private Messages (new composer actions)`, function (needs) {- needs.user();- needs.settings({ enable_new_composer_actions: true });- needs.pretender((server, helper) => {- server.get("/t/280.json", () => {- const json = cloneJSON(topicFixtures["/t/280/1.json"]);- json.archetype = "private_message";- return helper.response(json);- });- });-- test("dropdown reply-to-thread item uses the private message label", async function (assert) {- const composerActions = composerActionsDropdown();-- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");- await composerActions.expand();-- assert- .dom(".composer-actions-dropdown [data-action-id='reply_to_topic']")- .includesText(- i18n("composer.composer_actions.reply_to_message.label"),- "offers replying to the private message, not the topic"- );- });-});--acceptance(- `Prioritizing Name fall back (new composer actions)`,- function (needs) {- needs.user();- needs.settings({- prioritize_username_in_ux: false,- display_name_on_posts: true,- enable_new_composer_actions: true,- });-- test("Quotes fall back to username if name is not present", async function (assert) {- await visit("/t/internationalization-localization/130");- // select a user with no name- await selectText("#post_1 p");- await click(".insert-quote");- assert- .dom(".d-editor-input")- .hasValue(- '[quote="bianca, post:1, topic:130, full:true"]\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas a varius ipsum. Nunc euismod, metus non vulputate malesuada, ligula metus pharetra tortor, vel sodales arcu lacus sed mauris. Nam semper, orci vitae fringilla placerat, dui tellus convallis felis, ultricies laoreet sapien mi et metus. Mauris facilisis, mi fermentum rhoncus feugiat, dolor est vehicula leo, id porta leo ex non enim. In a ligula vel tellus commodo scelerisque non in ex. Pellentesque semper leo quam, nec varius est viverra eget. Donec vehicula sem et massa faucibus tempus.\n[/quote]\n\n'- );- });- }-);diff --git a/frontend/discourse/tests/acceptance/composer-actions-test.js b/frontend/discourse/tests/acceptance/composer-actions-test.jsindex bb1607fc4a3..b3667579996 100644--- a/frontend/discourse/tests/acceptance/composer-actions-test.js+++ b/frontend/discourse/tests/acceptance/composer-actions-test.js@@ -1,13 +1,14 @@import { click, fillIn, visit, waitFor } from "@ember/test-helpers";import { test } from "qunit";import sinon from "sinon";-import { cloneJSON } from "discourse/lib/object";-import Draft from "discourse/models/draft";import {_clearRegisteredActions,registerComposerAction,-} from "discourse/select-kit/components/composer-actions";+} from "discourse/lib/composer/actions-registry";+import { cloneJSON } from "discourse/lib/object";+import Draft from "discourse/models/draft";import discoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";+import topicFixtures from "discourse/tests/fixtures/topic";import userFixtures from "discourse/tests/fixtures/user-fixtures";import {acceptance,@@ -17,7 +18,26 @@ import {import selectKit from "discourse/tests/helpers/select-kit-helper";import { i18n } from "discourse-i18n";-acceptance(`Composer Actions`, function (needs) {+function composerActionsDropdown() {+ return {+ async expand() {+ await click(".composer-actions-trigger");+ },+ async selectRowByValue(value) {+ await click(`[data-action-id='${value}']`);+ },+ rows() {+ return document.querySelectorAll(+ ".composer-actions-dropdown [data-action-id]"+ );+ },+ actionIds() {+ return [...this.rows()].map((row) => row.dataset.actionId);+ },+ };+}++acceptance("Composer Actions", function (needs) {needs.user({id: 5,username: "kris",@@ -37,32 +57,32 @@ acceptance(`Composer Actions`, function (needs) {response.topic_list.can_create_topic = true;response.topic_list.filter = "c/shared-drafts/24/l/latest";+ return helper.response(response);+ });+ server.get("/t/54077.json", () => {+ const response = cloneJSON(topicFixtures["/t/54077.json"]);+ response.fancy_title =+ '<span dir="auto">Short topic with two posts</span>';+return helper.response(response);});});test("replying to post", async function (assert) {- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");await composerActions.expand();- assert.strictEqual(- composerActions.rowByIndex(0).value(),- "reply_as_new_topic"- );- assert.strictEqual(composerActions.rowByIndex(1).value(), "reply_to_topic");- assert.strictEqual(composerActions.rowByIndex(2).value(), "toggle_whisper");- assert.strictEqual(- composerActions.rowByIndex(3).value(),- "toggle_topic_bump"- );- assert.strictEqual(composerActions.rowByIndex(4).value(), null);+ assert.deepEqual(composerActions.actionIds().sort(), [+ "reply_as_new_topic",+ "reply_to_topic",+ ]);});test("replying to post - reply_to_topic", async function (assert) {- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");@@ -75,49 +95,46 @@ acceptance(`Composer Actions`, function (needs) {await composerActions.selectRowByValue("reply_to_topic");assert- .dom(".action-title .topic-link")- .hasText("Internationalization / localization");- assert- .dom(".action-title .topic-link")- .hasAttribute("href", "/t/internationalization-localization/280");+ .dom(".composer-actions-trigger")+ .includesText(i18n("composer.composer_actions.reply_to_topic.trigger"));assert.dom(".d-editor-input").hasValue("test replying to topic when initially replied to post");});- test("replying to post - toggle_whisper for whisperers", async function (assert) {+ test("toggle whisper via actions dropdown for whisperers", async function (assert) {updateCurrentUser({ admin: false, moderator: false });- const composerActions = selectKit(".composer-actions");await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");- await fillIn(- ".d-editor-input",- "test replying as whisper to topic when initially not a whisper"- );++ await click(".composer-actions-trigger");assert- .dom(".composer-actions svg.d-icon-far-eye-slash")- .doesNotExist("whisper icon is not visible");- assert- .dom(".composer-actions svg.d-icon-reply")- .exists("reply icon is visible");+ .dom(".composer-toggle-whisper")+ .exists("whisper toggle item is visible in dropdown");- await composerActions.expand();- await composerActions.selectRowByValue("toggle_whisper");+ await click(".composer-toggle-whisper .d-toggle-switch__checkbox");assert- .dom(".composer-actions svg.d-icon-far-eye-slash")- .exists("whisper icon is visible");+ .dom(+ ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='true']"+ )+ .exists("whisper toggle is on after click");++ await click(".composer-toggle-whisper .d-toggle-switch__checkbox");+assert- .dom(".composer-actions svg.d-icon-reply")- .doesNotExist("reply icon is not visible");+ .dom(+ ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='false']"+ )+ .exists("whisper toggle is off after second click");});test("replying to post - reply_as_new_topic", async function (assert) {sinon.stub(Draft, "get").resolves({ draft: "", draft_sequence: 0 });- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();const categoryChooser = selectKit(".title-wrapper .category-chooser");const categoryChooserReplyArea = selectKit(".reply-area .category-chooser");const quote = "test replying as new topic when initially replied to post";@@ -136,34 +153,22 @@ acceptance(`Composer Actions`, function (needs) {await composerActions.selectRowByValue("reply_as_new_topic");assert.strictEqual(categoryChooserReplyArea.header().name(), "faq");- assert.dom(".action-title").hasText(i18n("topic.create_long"));assert.dom(".d-editor-input").includesValue(quote);});test("reply_as_new_topic without a new_topic draft", async function (assert) {await visit("/t/internationalization-localization/280");await click(".create.reply");- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await composerActions.expand();await composerActions.selectRowByValue("reply_as_new_topic");assert.dom(".dialog-body").doesNotExist();});- test("reply_as_new_topic without a permission to create topic", async function (assert) {- updateCurrentUser({ can_create_topic: false });- await visit("/t/internationalization-localization/280");- await click(".create.reply");- const composerActions = selectKit(".composer-actions");- await composerActions.expand();- assert- .dom(".composer-actions svg.d-icon-plus")- .doesNotExist("reply as new topic icon is not visible");- });-test("reply_as_new_group_message", async function (assert) {await visit("/t/lorem-ipsum-dolor-sit-amet/130");await click(".create.reply");- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await composerActions.expand();await composerActions.selectRowByValue("reply_as_new_group_message");@@ -171,8 +176,19 @@ acceptance(`Composer Actions`, function (needs) {assert.deepEqual(privateMessageUsers.header().value(), "foo,foo_group");});+ test("reply_as_new_topic without a permission to create topic", async function (assert) {+ updateCurrentUser({ can_create_topic: false });+ await visit("/t/internationalization-localization/280");+ await click(".create.reply");+ const composerActions = composerActionsDropdown();+ await composerActions.expand();+ assert+ .dom(".composer-actions-dropdown [data-action-id='reply_as_new_topic']")+ .doesNotExist("reply as new topic option is not visible");+ });+test("interactions", async function (assert) {- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();const quote = "Life is like riding a bicycle.";await visit("/t/short-topic-with-two-posts/54077");@@ -181,177 +197,109 @@ acceptance(`Composer Actions`, function (needs) {await composerActions.expand();await composerActions.selectRowByValue("reply_to_topic");- assert.dom(".action-title").hasText("Short topic with two posts");+ assert+ .dom(".composer-actions-trigger")+ .includesText(i18n("composer.composer_actions.reply_to_topic.trigger"));assert.dom(".d-editor-input").hasValue(quote);await composerActions.expand();- assert.strictEqual(- composerActions.rowByIndex(0).value(),- "reply_as_new_topic"- );- assert.strictEqual(composerActions.rowByIndex(1).value(), "reply_to_post");- assert.strictEqual(composerActions.rowByIndex(2).value(), "toggle_whisper");- assert.strictEqual(- composerActions.rowByIndex(3).value(),- "toggle_topic_bump"- );- assert.strictEqual(composerActions.rows().length, 4);+ assert.deepEqual(composerActions.actionIds().sort(), [+ "reply_as_new_topic",+ "reply_to_post",+ ]);await composerActions.selectRowByValue("reply_to_post");await composerActions.expand();- assert.dom(".action-title img.avatar").exists();- assert.dom(".action-title .user-link").hasText("tms");+ assert.dom(".composer-actions-trigger").includesText("tms");assert.dom(".d-editor-input").hasValue(quote);- assert.strictEqual(- composerActions.rowByIndex(0).value(),- "reply_as_new_topic"- );- assert.strictEqual(composerActions.rowByIndex(1).value(), "reply_to_topic");- assert.strictEqual(composerActions.rowByIndex(2).value(), "toggle_whisper");- assert.strictEqual(- composerActions.rowByIndex(3).value(),- "toggle_topic_bump"- );- assert.strictEqual(composerActions.rows().length, 4);+ assert.deepEqual(composerActions.actionIds().sort(), [+ "reply_as_new_topic",+ "reply_to_topic",+ ]);await composerActions.selectRowByValue("reply_as_new_topic");await composerActions.expand();- assert.dom(".action-title").hasText(i18n("topic.create_long"));assert.dom(".d-editor-input").includesValue(quote);- assert.strictEqual(composerActions.rowByIndex(0).value(), "reply_to_post");- assert.strictEqual(composerActions.rowByIndex(1).value(), "reply_to_topic");- assert.strictEqual(- composerActions.rowByIndex(2).value(),- "toggle_unlisted"- );- assert.strictEqual(composerActions.rowByIndex(3).value(), "shared_draft");- assert.strictEqual(- composerActions.rowByIndex(4).value(),- "create_private_message"- );- assert.strictEqual(composerActions.rows().length, 5);- });-- test("new topic in shared drafts category opens shared draft composer", async function (assert) {- await visit("/c/shared-drafts/24");-- assert.dom("#create-topic").hasText(i18n("topic.create_shared_draft"));-- await click("#create-topic");-- assert- .dom("#reply-control .btn-primary.create .d-button-label")- .hasText(i18n("composer.create_shared_draft"));- assert- .dom(".composer-actions svg.d-icon-far-clipboard")- .exists("shared draft icon is visible");- assert.strictEqual(- selectKit(".category-chooser").header().value(),- null,- "shared drafts category is not selected as the destination category"- );+ assert.deepEqual(composerActions.actionIds().sort(), [+ "create_private_message",+ "reply_to_post",+ "reply_to_topic",+ "shared_draft",+ ]);});test("interactions - private message", async function (assert) {- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await visit("/t/internationalization-localization/280");await click('#post_4 a[data-user-card="shade"]');await click(".usercard-controls .compose-pm .btn-primary");await composerActions.expand();- assert.dom(".action-title").hasText(i18n("topic.private_message"));- assert.strictEqual(composerActions.rowByIndex(0).value(), "create_topic");- assert.strictEqual(composerActions.rows().length, 1);+ assert.deepEqual(composerActions.actionIds().sort(), ["create_topic"]);});- test("replying to post - toggle_topic_bump", async function (assert) {- const composerActions = selectKit(".composer-actions");-+ test("reply target link uses plain topic title when fancy title includes HTML", async function (assert) {await visit("/t/short-topic-with-two-posts/54077");- await click("article#post_2 button.reply");-- assert- .dom(".composer-actions svg.d-icon-anchor")- .doesNotExist("no-bump icon is not visible");- assert- .dom(".composer-actions svg.d-icon-reply")- .exists("reply icon is visible");-- await composerActions.expand();- await composerActions.selectRowByValue("toggle_topic_bump");-- assert- .dom(".composer-actions svg.d-icon-anchor")- .exists("no-bump icon is visible");- assert- .dom(".composer-actions svg.d-icon-reply")- .doesNotExist("reply icon is not visible");+ await click(".create.reply");- await composerActions.expand();- await composerActions.selectRowByValue("toggle_topic_bump");+ await visit("/");+ await waitFor(".composer-actions-reply-target-link__label");assert- .dom(".composer-actions svg.d-icon-anchor")- .doesNotExist("no-bump icon is not visible");- assert- .dom(".composer-actions svg.d-icon-reply")- .exists("reply icon is visible");+ .dom(".composer-actions-reply-target-link__label")+ .hasText(+ "Short topic with two posts",+ "renders the plain topic title in the reply target link"+ );});- test("replying to post - whisper and no bump", async function (assert) {- const composerActions = selectKit(".composer-actions");-+ test("toggle no-bump via actions dropdown", async function (assert) {await visit("/t/short-topic-with-two-posts/54077");await click("article#post_2 button.reply");+ await click(".composer-actions-trigger");+assert- .dom(".composer-actions svg.d-icon-far-eye-slash")- .doesNotExist("whisper icon is not visible");- assert- .dom(".reply-details .whisper .d-icon-anchor")- .doesNotExist("no-bump icon is not visible");- assert- .dom(".composer-actions svg.d-icon-reply")- .exists("reply icon is visible");+ .dom(".composer-toggle-no-bump")+ .exists("no-bump toggle item is visible in dropdown");- await composerActions.expand();- await composerActions.selectRowByValue("toggle_topic_bump");- await composerActions.expand();- await composerActions.selectRowByValue("toggle_whisper");+ await click(".composer-toggle-no-bump .d-toggle-switch__checkbox");assert- .dom(".composer-actions svg.d-icon-far-eye-slash")- .exists("whisper icon is visible");- assert- .dom(".reply-details .no-bump .d-icon-anchor")- .exists("no-bump icon is visible");+ .dom(+ ".composer-toggle-no-bump .d-toggle-switch__checkbox[aria-checked='true']"+ )+ .exists("no-bump toggle is on after click");++ await click(".composer-toggle-no-bump .d-toggle-switch__checkbox");+assert- .dom(".composer-actions svg.d-icon-reply")- .doesNotExist("reply icon is not visible");+ .dom(+ ".composer-toggle-no-bump .d-toggle-switch__checkbox[aria-checked='false']"+ )+ .exists("no-bump toggle is off after second click");});- test("replying to post as staff", async function (assert) {- const composerActions = selectKit(".composer-actions");-+ test("replying to post as staff shows whisper + no-bump toggles in dropdown", async function (assert) {updateCurrentUser({ admin: true });await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");- await composerActions.expand();- assert.strictEqual(composerActions.rows().length, 4);- assert.strictEqual(- composerActions.rowByIndex(3).value(),- "toggle_topic_bump"- );- });+ await click(".composer-actions-trigger");- test("replying to post as TL3 user", async function (assert) {- const composerActions = selectKit(".composer-actions");+ assert+ .dom(".composer-toggle-whisper")+ .exists("whisper toggle is visible for staff");+ assert+ .dom(".composer-toggle-no-bump")+ .exists("no-bump toggle is visible for staff");+ });+ test("replying to post as TL3 user shows no toggles in dropdown", async function (assert) {updateCurrentUser({moderator: false,admin: false,@@ -361,21 +309,18 @@ acceptance(`Composer Actions`, function (needs) {});await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");- await composerActions.expand();- assert.strictEqual(composerActions.rows().length, 2);- Array.from(composerActions.rows()).forEach((row) => {- assert.notStrictEqual(- row.value,- "toggle_topic_bump",- "toggle button is not visible"- );- });- });+ await click(".composer-actions-trigger");- test("replying to post as TL4 user", async function (assert) {- const composerActions = selectKit(".composer-actions");+ assert+ .dom(".composer-toggle-whisper")+ .doesNotExist("whisper toggle is not visible for TL3 non-whisperer");+ assert+ .dom(".composer-toggle-no-bump")+ .doesNotExist("no-bump toggle is not visible for TL3 non-whisperer");+ });+ test("replying to post as TL4 user shows no-bump toggle in dropdown", async function (assert) {updateCurrentUser({moderator: false,admin: false,@@ -385,25 +330,145 @@ acceptance(`Composer Actions`, function (needs) {});await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");++ await click(".composer-actions-trigger");++ assert+ .dom(".composer-toggle-no-bump")+ .exists("no-bump toggle is visible for TL4");+ });++ test("editing post", async function (assert) {+ const composerActions = composerActionsDropdown();++ await visit("/t/internationalization-localization/280");+ await click("article#post_1 button.show-more-actions");+ await click("article#post_1 button.edit");await composerActions.expand();- assert.strictEqual(composerActions.rows().length, 3);- assert.strictEqual(- composerActions.rowByIndex(2).value(),- "toggle_topic_bump"+ assert.deepEqual(+ composerActions.actionIds(),+ [],+ "no switch actions are offered while editing a post");});- test("editing post", async function (assert) {- const composerActions = selectKit(".composer-actions");+ test("trigger shows correct icon for reply mode", async function (assert) {+ await visit("/t/internationalization-localization/280");+ await click("article#post_3 button.reply");+ assert+ .dom(".composer-actions-trigger svg.d-icon-share")+ .exists("shows share icon when replying");+ });++ test("trigger shows correct icon for create topic mode", async function (assert) {+ await visit("/");+ await click("#create-topic");++ assert+ .dom(".composer-actions-trigger svg.d-icon-far-pen-to-square")+ .exists("shows pen-to-square icon when creating topic");+ });++ test("trigger shows correct icon for editing", async function (assert) {await visit("/t/internationalization-localization/280");await click("article#post_1 button.show-more-actions");await click("article#post_1 button.edit");++ assert+ .dom(".composer-actions-trigger svg.d-icon-pencil")+ .exists("shows pencil icon when editing");+ });++ test("trigger shows correct label for reply mode", async function (assert) {+ await visit("/t/internationalization-localization/280");+ await click("article#post_3 button.reply");++ assert+ .dom(".composer-actions-trigger")+ .includesText("codinghorror", "shows reply to post label");+ });++ test("trigger shows the private message label when replying in a PM", async function (assert) {+ await visit("/t/lorem-ipsum-dolor-sit-amet/130");+ await click(".create.reply");++ assert+ .dom(".composer-actions-trigger")+ .includesText(+ i18n("composer.composer_actions.reply_to_message.trigger"),+ "shows the private message reply label, not the topic label"+ );+ });++ test("trigger shows correct label for create topic mode", async function (assert) {+ await visit("/");+ await click("#create-topic");++ assert+ .dom(".composer-actions-trigger")+ .includesText(+ i18n("composer.composer_actions.create_topic.label"),+ "shows create topic label"+ );+ });++ test("create topic mode shows correct actions and unlisted toggle", async function (assert) {+ const composer = this.owner.lookup("service:composer");+ const composerActions = composerActionsDropdown();+ updateCurrentUser({ admin: true });++ await visit("/");+ await click("#create-topic");await composerActions.expand();- assert.strictEqual(composerActions.rows().length, 1);- assert.strictEqual(composerActions.rowByIndex(0).value(), "reply_to_post");+ assert+ .dom(+ ".composer-actions-dropdown [data-action-id='create_private_message']"+ )+ .exists("shows create private message action");++ assert+ .dom(".composer-toggle-unlisted")+ .exists("unlisted toggle is visible for staff in create topic mode");++ await click(".composer-toggle-unlisted .d-toggle-switch__checkbox");+ composer.model.set("noBump", true);++ assert+ .dom(+ ".composer-toggle-unlisted .d-toggle-switch__checkbox[aria-checked='true']"+ )+ .exists("unlisted toggle is on after click");++ await composerActions.selectRowByValue("create_private_message");++ assert.false(+ composer.model.unlistTopic,+ "unlisted state is cleared when switching to a private message"+ );+ assert.false(+ composer.model.noBump,+ "no-bump state is cleared when switching to a private message"+ );++ await composerActions.expand();+ assert+ .dom(".composer-toggle-unlisted")+ .doesNotExist("unlisted toggle is not shown in private message mode");+ });++ test("create topic mode does not show reply_as_new_topic", async function (assert) {+ const composerActions = composerActionsDropdown();++ await visit("/");+ await click("#create-topic");+ await composerActions.expand();++ assert+ .dom(".composer-actions-dropdown [data-action-id='reply_as_new_topic']")+ .doesNotExist("does not show reply_as_new_topic in create topic mode");});});@@ -415,7 +480,7 @@ function stubDraftResponse() {});}-acceptance(`Composer Actions With New Topic Draft`, function (needs) {+acceptance("Composer Actions With New Topic Draft", function (needs) {needs.user({ whisperer: true });needs.site({@@ -443,7 +508,7 @@ acceptance(`Composer Actions With New Topic Draft`, function (needs) {await tags.expand();await tags.selectRowByName("monkey");- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await composerActions.expand();await composerActions.selectRowByValue("shared_draft");@@ -456,8 +521,18 @@ acceptance(`Composer Actions With New Topic Draft`, function (needs) {.dom("#reply-control .btn-primary.create .d-button-label").hasText(i18n("composer.create_shared_draft"));assert- .dom(".composer-actions svg.d-icon-far-clipboard")+ .dom(".composer-actions-trigger svg.d-icon-far-clipboard").exists("shared draft icon is visible");++ await composerActions.expand();+ assert+ .dom(".composer-actions-dropdown [data-action-id='create_topic']")+ .exists("can switch back to create topic from shared draft mode");+ assert+ .dom(+ ".composer-actions-dropdown [data-action-id='create_private_message']"+ )+ .exists("can switch to PM from shared draft mode");});test("reply_as_new_topic with new_topic draft", async function (assert) {@@ -466,7 +541,7 @@ acceptance(`Composer Actions With New Topic Draft`, function (needs) {stubDraftResponse();- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await composerActions.expand();await composerActions.selectRowByValue("reply_as_new_topic");@@ -479,7 +554,7 @@ acceptance(`Composer Actions With New Topic Draft`, function (needs) {});});-acceptance(`Prioritize Username`, function (needs) {+acceptance("Prioritize Username", function (needs) {needs.user();needs.settings({prioritize_username_in_ux: true,@@ -490,7 +565,7 @@ acceptance(`Prioritize Username`, function (needs) {await visit("/t/short-topic-with-two-posts/54079");await click("article#post_2 button.reply");- assert.dom(".action-title .user-link").hasText("james_john");+ assert.dom(".composer-actions-trigger").includesText("james_john");});test("Quotes use username", async function (assert) {@@ -505,7 +580,7 @@ acceptance(`Prioritize Username`, function (needs) {});});-acceptance(`Prioritize Full Name`, function (needs) {+acceptance("Prioritize Full Name", function (needs) {needs.user();needs.settings({prioritize_username_in_ux: false,@@ -514,11 +589,11 @@ acceptance(`Prioritize Full Name`, function (needs) {test("Reply to post use full name", async function (assert) {await visit("/t/short-topic-with-two-posts/54079");- await click("article#post_3 button.reply");+ await click("article#post_2 button.reply");assert- .dom(".action-title .user-link")- .hasHtml("<h1>Tim Stone</h1>");+ .dom(".composer-actions-trigger")+ .includesText("james, john, the third");});test("Quotes use full name", async function (assert) {@@ -544,7 +619,62 @@ acceptance(`Prioritize Full Name`, function (needs) {});});-acceptance(`Prioritizing Name fall back`, function (needs) {+acceptance("Slow Mode", function (needs) {+ needs.user();+ needs.pretender((server, helper) => {+ server.get("/t/130.json", () => {+ const json = cloneJSON(topicFixtures["/t/130.json"]);+ // The 130 fixture is a PM; slow mode only applies to regular topics.+ json.archetype = "regular";+ json.slow_mode_seconds = 600;+ json.slow_mode_enabled_until = "2040-01-01T04:00:00.000Z";+ return helper.response(json);+ });+ });++ test("trigger shows the regular reply label with the slow-mode icon", async function (assert) {+ await visit("/t/internationalization-localization/130");+ await click("article#post_1 button.reply");++ assert+ .dom(".composer-actions-trigger svg.d-icon-hourglass-start")+ .exists("uses the slow-mode hourglass icon");+ assert+ .dom(".composer-actions-trigger")+ .includesText(+ i18n("composer.composer_actions.reply_to_topic.trigger"),+ "falls back to the standard reply-to-topic trigger label"+ );+ });+});++acceptance("Private Messages", function (needs) {+ needs.user();+ needs.pretender((server, helper) => {+ server.get("/t/280.json", () => {+ const json = cloneJSON(topicFixtures["/t/280/1.json"]);+ json.archetype = "private_message";+ return helper.response(json);+ });+ });++ test("dropdown reply-to-thread item uses the private message label", async function (assert) {+ const composerActions = composerActionsDropdown();++ await visit("/t/internationalization-localization/280");+ await click("article#post_3 button.reply");+ await composerActions.expand();++ assert+ .dom(".composer-actions-dropdown [data-action-id='reply_to_topic']")+ .includesText(+ i18n("composer.composer_actions.reply_to_message.label"),+ "offers replying to the private message, not the topic"+ );+ });+});++acceptance("Prioritizing Name fall back", function (needs) {needs.user();needs.settings({prioritize_username_in_ux: false,@@ -564,7 +694,7 @@ acceptance(`Prioritizing Name fall back`, function (needs) {});});-acceptance(`Composer Actions - plugin registration`, function (needs) {+acceptance("Composer Actions - plugin registration", function (needs) {needs.user();let lastInvocation;@@ -590,32 +720,32 @@ acceptance(`Composer Actions - plugin registration`, function (needs) {});test("registered action appears in dropdown when condition is true", async function (assert) {- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");await composerActions.expand();assert- .dom(`.composer-actions li[data-value="my_plugin_action"]`)+ .dom(".composer-actions-dropdown [data-action-id='my_plugin_action']").exists("the registered action is rendered");});test("registered action is hidden when condition is false", async function (assert) {showCustomAction = false;- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");await composerActions.expand();assert- .dom(`.composer-actions li[data-value="my_plugin_action"]`)+ .dom(".composer-actions-dropdown [data-action-id='my_plugin_action']").doesNotExist("the registered action is not rendered");});test("selecting the registered action invokes its callback", async function (assert) {- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");@@ -642,18 +772,18 @@ acceptance(`Composer Actions - plugin registration`, function (needs) {const errorStub = sinon.stub(console, "error");try {- const composerActions = selectKit(".composer-actions");+ const composerActions = composerActionsDropdown();await visit("/t/internationalization-localization/280");await click("article#post_3 button.reply");await composerActions.expand();- await composerActions.collapse();+ await click(".composer-actions-trigger");await composerActions.expand();- await composerActions.collapse();+ await click(".composer-actions-trigger");await composerActions.expand();assert- .dom(`.composer-actions .select-kit-row[data-value="broken_action"]`)+ .dom(".composer-actions-dropdown [data-action-id='broken_action']").doesNotExist("broken action is hidden");const calls = errorStub.getCalls()diff --git a/frontend/discourse/tests/acceptance/composer-new-test.js b/frontend/discourse/tests/acceptance/composer-new-test.jsdeleted file mode 100644index fbeb60f1930..00000000000--- a/frontend/discourse/tests/acceptance/composer-new-test.js+++ /dev/null@@ -1,352 +0,0 @@-import { click, fillIn, settled, visit } from "@ember/test-helpers";-import { module, test } from "qunit";-import sinon from "sinon";-import { cloneJSON } from "discourse/lib/object";-import { withPluginApi } from "discourse/lib/plugin-api";-import { CREATE_TOPIC } from "discourse/models/composer";-import Draft from "discourse/models/draft";-import TopicFixtures from "discourse/tests/fixtures/topic";-import {- acceptance,- updateCurrentUser,-} from "discourse/tests/helpers/qunit-helpers";-import selectKit from "discourse/tests/helpers/select-kit-helper";-import { i18n } from "discourse-i18n";--acceptance(`Composer (new composer actions)`, function (needs) {- needs.user({- id: 5,- username: "kris",- whisperer: true,- });- needs.settings({- general_category_id: 1,- default_composer_category: 1,- enable_new_composer_actions: true,- });- needs.site({- can_tag_topics: true,- categories: [- {- id: 1,- name: "General",- slug: "general",- permission: 1,- topic_template: null,- },- ],- });- needs.pretender((server, helper) => {- server.put("/u/kris.json", () => helper.response({ user: {} }));- server.get("/t/960.json", () => {- const topicList = cloneJSON(TopicFixtures["/t/9/1.json"]);- topicList.post_stream.posts[2].post_type = 4;- return helper.response(topicList);- });- });-- test("Replying to the first post in a topic is a topic reply", async function (assert) {- await visit("/t/internationalization-localization/280");-- await click("#post_1 .reply.create");- assert- .dom(".composer-actions-trigger")- .includesText(i18n("composer.composer_actions.reply_to_topic.trigger"));-- await click("#post_1 .reply.create");- assert- .dom(".composer-actions-trigger")- .includesText(i18n("composer.composer_actions.reply_to_topic.trigger"));- });-- test("Composer can toggle whispers when whisperer user", async function (assert) {- await visit("/t/this-is-a-test-topic/9");- await click(".topic-post[data-post-number='1'] button.reply");-- await click(".composer-actions-trigger");-- assert- .dom(".composer-toggle-whisper")- .exists("whisper toggle item is visible in dropdown");-- await click(".composer-toggle-whisper .d-toggle-switch__checkbox");-- assert- .dom(- ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='true']"- )- .exists("sets the post type to whisper");-- await click(".composer-toggle-whisper .d-toggle-switch__checkbox");-- assert- .dom(- ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='false']"- )- .exists("removes the whisper mode");- });-- module(- "Composer can switch between new topic and new PM in different contexts",- function () {- test("within post/topic context", async function (assert) {- const composer = this.owner.lookup("service:composer");-- await visit("/t/this-is-a-test-topic/54081");- await click(".topic-post[data-post-number='1'] button.reply");- await click(".composer-actions-trigger");- assert- .dom(- ".composer-actions-dropdown [data-action-id='create_private_message']"- )- .doesNotExist("New message option is not present when in reply mode");- await click(".composer-actions-trigger");-- await visit("/");- await composer.openNewTopic();- await settled();- await click(".composer-actions-trigger");- assert- .dom(".composer-actions-dropdown [data-action-id='reply_to_topic']")- .doesNotExist(- "stale topic context is cleared when opening a fresh new-topic composer"- );- assert- .dom(".composer-actions-dropdown [data-action-id='reply_to_post']")- .doesNotExist(- "stale post context is cleared when opening a fresh new-topic composer"- );-- await click("[data-action-id='create_private_message']");- assert- .dom(".save-or-cancel button")- .hasText(i18n("composer.create_pm"));-- await click(".composer-actions-trigger");- await click("[data-action-id='create_topic']");- assert- .dom(".save-or-cancel button")- .hasText(i18n("composer.create_topic"));- });-- test("fresh new message clears stale reply context", async function (assert) {- const composer = this.owner.lookup("service:composer");-- await visit("/t/this-is-a-test-topic/54081");- await click(".topic-post[data-post-number='1'] button.reply");-- await visit("/");- await composer.openNewMessage({ recipients: "shade" });- await settled();-- await click(".composer-actions-trigger");- assert- .dom(".composer-actions-dropdown [data-action-id='reply_to_topic']")- .doesNotExist(- "stale topic context is cleared when opening a fresh message composer"- );- assert- .dom(".composer-actions-dropdown [data-action-id='reply_to_post']")- .doesNotExist(- "stale post context is cleared when opening a fresh message composer"- );- });-- test("topic context is cleared after a successful save", async function (assert) {- await visit("/t/internationalization-localization/280");- await click("article#post_3 button.reply");- await fillIn(".d-editor-input", "this is a successful reply");- await click("#reply-control button.create");-- await visit("/");- await click("#create-topic");- await click(".composer-actions-trigger");-- assert- .dom(".composer-actions-dropdown [data-action-id='reply_to_topic']")- .doesNotExist(- "reply_to_topic is not surfaced after the previous composer was saved"- );- assert- .dom(".composer-actions-dropdown [data-action-id='reply_to_post']")- .doesNotExist(- "reply_to_post is not surfaced after the previous composer was saved"- );- });- }- );-- test("Composer can toggle between reply and createTopic", async function (assert) {- updateCurrentUser({ admin: true });- await visit("/t/this-is-a-test-topic/54081");- await click(".topic-post[data-post-number='1'] button.reply");-- await click(".composer-actions-trigger");- await click(".composer-toggle-whisper .d-toggle-switch__checkbox");-- assert- .dom(- ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='true']"- )- .exists("sets the post type to whisper");- await click(".composer-actions-trigger");-- await visit("/");- assert.dom("#create-topic").exists("the create topic button is visible");-- await click("#create-topic");- assert- .dom(".composer-whisper-indicator.--whispering")- .doesNotExist("should reset the state of the composer's model");- assert- .dom(".save-or-cancel button .d-icon-far-eye-slash")- .doesNotExist("the save button should not use the whisper icon");-- await click(".composer-actions-trigger");- await click(".composer-toggle-unlisted .d-toggle-switch__checkbox");-- assert- .dom(- ".composer-toggle-unlisted .d-toggle-switch__checkbox[aria-checked='true']"- )- .exists("sets the topic to unlisted");-- await visit("/t/this-is-a-test-topic/9");-- await click(".topic-post[data-post-number='1'] button.reply");- assert- .dom(".composer-whisper-indicator.--whispering")- .doesNotExist("should reset the state of the composer's model");- assert- .dom(".composer-whisper-indicator.--public")- .exists("the closed-state whisper indicator shows the reply is public");- });-- test("Composer whisper toggle not shown when replying to whisper", async function (assert) {- await visit("/t/topic-with-whisper/960");-- await click(".topic-post[data-post-number='3'] button.reply");- await click(".composer-actions-trigger");- assert- .dom(".composer-toggle-whisper")- .doesNotExist("whisper toggle is not available when reply to whisper");- await click(".composer-actions-trigger");-- await click(".composer-actions-trigger");- await click("[data-action-id='reply_to_topic']");-- await click(".composer-actions-trigger");- assert- .dom(".composer-toggle-whisper")- .exists("whisper toggle is available when reply to topic");- });-- test("Composer whisper toggle available when replying to topic after whisper", async function (assert) {- await visit("/t/topic-with-whisper/54081");-- await click(".topic-post[data-post-number='3'] button.reply");- await click("#reply-control .discard-button");- await click(".timeline-footer-controls button.create");-- await click(".composer-actions-trigger");- assert- .dom(".composer-toggle-whisper")- .exists("whisper toggle is available when reply to topic");- });-- test("Can switch states without abandon popup", async function (assert) {- await visit("/t/internationalization-localization/280");-- const longText = "a".repeat(256);-- sinon.stub(Draft, "get").resolves({- draft: null,- draft_sequence: 0,- });-- await click(".btn-primary.create.btn");-- await fillIn(".d-editor-input", longText);-- assert- .dom(".composer-actions-trigger")- .includesText(- i18n("composer.composer_actions.reply_to_topic.trigger"),- "the mode should be: reply to topic"- );-- await click("article#post_3 button.reply");-- await click(".composer-actions-trigger");- await click("[data-action-id='reply_as_new_topic']");-- assert.dom(".d-modal__body").doesNotExist("abandon popup shouldn't come");-- assert- .dom(".d-editor-input")- .includesValue(longText, "entered text should still be there");-- assert- .dom(".composer-actions-trigger")- .includesText(- i18n("composer.composer_actions.create_topic.label"),- "mode should have changed to create topic"- );- });-});--acceptance(- `Composer - Customizations (new composer actions)`,- function (needs) {- needs.user();- needs.site({ can_tag_topics: true });- needs.settings({- enable_new_composer_actions: true,- });-- function customComposerAction(composer) {- const tags = composer.tags || [];- const hasMonkey = tags.some(- (t) => (typeof t === "string" ? t : t.name) === "monkey"- );- return hasMonkey && composer.action === CREATE_TOPIC;- }-- needs.hooks.beforeEach(() => {- withPluginApi((api) => {- api.customizeComposerText({- actionTitle(model) {- if (customComposerAction(model)) {- return "custom text";- }- },-- saveLabel(model) {- if (customComposerAction(model)) {- return "composer.emoji";- }- },- });- });- });-- test("Supports text customization", async function (assert) {- await visit("/");- await click("#create-topic");- assert- .dom(".composer-actions-trigger")- .includesText(- i18n("composer.composer_actions.create_topic.label"),- "trigger shows create topic label"- );- assert- .dom(".save-or-cancel button")- .hasText(i18n("composer.create_topic"));- const tags = selectKit(".mini-tag-chooser");- await tags.expand();- await tags.selectRowByName("monkey");- assert.dom(".composer-actions-trigger").includesText("custom text");- assert.dom(".save-or-cancel button").hasText(i18n("composer.emoji"));- });- }-);diff --git a/frontend/discourse/tests/acceptance/composer-test.js b/frontend/discourse/tests/acceptance/composer-test.jsindex 7652a7d2965..1fe27a57f38 100644--- a/frontend/discourse/tests/acceptance/composer-test.js+++ b/frontend/discourse/tests/acceptance/composer-test.js@@ -27,6 +27,7 @@ import pretender, { response } from "discourse/tests/helpers/create-pretender";import {acceptance,metaModifier,+ updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";import selectKit from "discourse/tests/helpers/select-kit-helper";import {@@ -732,13 +733,13 @@ acceptance(`Composer`, function (needs) {await click("#post_1 .reply.create");assert- .dom(".reply-details a.topic-link")- .hasText("Internationalization / localization");+ .dom(".composer-actions-trigger")+ .includesText(i18n("composer.composer_actions.reply_to_topic.trigger"));await click("#post_1 .reply.create");assert- .dom(".reply-details a.topic-link")- .hasText("Internationalization / localization");+ .dom(".composer-actions-trigger")+ .includesText(i18n("composer.composer_actions.reply_to_topic.trigger"));});test("Can edit a post after starting a reply", async function (assert) {@@ -1120,24 +1121,30 @@ acceptance(`Composer`, function (needs) {});test("Composer can toggle whispers when whisperer user", async function (assert) {- const menu = selectKit(".composer-actions");-await visit("/t/this-is-a-test-topic/9");await click(".topic-post[data-post-number='1'] button.reply");- await menu.expand();- await menu.selectRowByValue("toggle_whisper");+ await click(".composer-actions-trigger");++ assert+ .dom(".composer-toggle-whisper")+ .exists("whisper toggle item is visible in dropdown");++ await click(".composer-toggle-whisper .d-toggle-switch__checkbox");assert- .dom(".composer-actions svg.d-icon-far-eye-slash")+ .dom(+ ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='true']"+ ).exists("sets the post type to whisper");- await menu.expand();- await menu.selectRowByValue("toggle_whisper");+ await click(".composer-toggle-whisper .d-toggle-switch__checkbox");assert- .dom(".composer-actions svg.d-icon-far-eye-slash")- .doesNotExist("removes the whisper mode");+ .dom(+ ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='false']"+ )+ .exists("removes the whisper mode");});test("Composer can toggle layouts (open, fullscreen and draft)", async function (assert) {@@ -1202,103 +1209,168 @@ acceptance(`Composer`, function (needs) {"Composer can switch between new topic and new PM in different contexts",function () {test("within post/topic context", async function (assert) {+ const composer = this.owner.lookup("service:composer");+await visit("/t/this-is-a-test-topic/54081");await click(".topic-post[data-post-number='1'] button.reply");- await selectKit(".composer-actions").expand();- assert.notStrictEqual(- selectKit(".composer-actions")- .rowByValue("create_private_message")- .exists(),- "New message option is not present when in reply mode"- );-- await click("#reply-control .discard-button");+ await click(".composer-actions-trigger");+ assert+ .dom(+ ".composer-actions-dropdown [data-action-id='create_private_message']"+ )+ .doesNotExist("New message option is not present when in reply mode");+ await click(".composer-actions-trigger");+await visit("/");- await click("#create-topic");- await selectKit(".composer-actions").expand();- assert.true(- selectKit(".composer-actions").rowByValue("reply_to_topic").exists(),- "composer topic context is preserved when reopened"- );-- await selectKit(".composer-actions").selectRowByValue(- "create_private_message"- );- assert.dom(".action-title").hasText(i18n("topic.private_message"));+ await composer.openNewTopic();+ await settled();+ await click(".composer-actions-trigger");+ assert+ .dom(".composer-actions-dropdown [data-action-id='reply_to_topic']")+ .doesNotExist(+ "stale topic context is cleared when opening a fresh new-topic composer"+ );+ assert+ .dom(".composer-actions-dropdown [data-action-id='reply_to_post']")+ .doesNotExist(+ "stale post context is cleared when opening a fresh new-topic composer"+ );++ await click("[data-action-id='create_private_message']");assert.dom(".save-or-cancel button").hasText(i18n("composer.create_pm"));- await selectKit(".composer-actions").expand();- await selectKit(".composer-actions").selectRowByValue("create_topic");- assert.dom(".action-title").hasText(i18n("topic.create_long"));+ await click(".composer-actions-trigger");+ await click("[data-action-id='create_topic']");assert.dom(".save-or-cancel button").hasText(i18n("composer.create_topic"));});++ test("fresh new message clears stale reply context", async function (assert) {+ const composer = this.owner.lookup("service:composer");++ await visit("/t/this-is-a-test-topic/54081");+ await click(".topic-post[data-post-number='1'] button.reply");++ await visit("/");+ await composer.openNewMessage({ recipients: "shade" });+ await settled();++ await click(".composer-actions-trigger");+ assert+ .dom(".composer-actions-dropdown [data-action-id='reply_to_topic']")+ .doesNotExist(+ "stale topic context is cleared when opening a fresh message composer"+ );+ assert+ .dom(".composer-actions-dropdown [data-action-id='reply_to_post']")+ .doesNotExist(+ "stale post context is cleared when opening a fresh message composer"+ );+ });++ test("topic context is cleared after a successful save", async function (assert) {+ await visit("/t/internationalization-localization/280");+ await click("article#post_3 button.reply");+ await fillIn(".d-editor-input", "this is a successful reply");+ await click("#reply-control button.create");++ await visit("/");+ await click("#create-topic");+ await click(".composer-actions-trigger");++ assert+ .dom(".composer-actions-dropdown [data-action-id='reply_to_topic']")+ .doesNotExist(+ "reply_to_topic is not surfaced after the previous composer was saved"+ );+ assert+ .dom(".composer-actions-dropdown [data-action-id='reply_to_post']")+ .doesNotExist(+ "reply_to_post is not surfaced after the previous composer was saved"+ );+ });});test("Composer can toggle between reply and createTopic", async function (assert) {+ updateCurrentUser({ admin: true });await visit("/t/this-is-a-test-topic/54081");await click(".topic-post[data-post-number='1'] button.reply");- await selectKit(".composer-actions").expand();-- await selectKit(".composer-actions").selectRowByValue("toggle_whisper");+ await click(".composer-actions-trigger");+ await click(".composer-toggle-whisper .d-toggle-switch__checkbox");assert- .dom(".composer-actions svg.d-icon-far-eye-slash")+ .dom(+ ".composer-toggle-whisper .d-toggle-switch__checkbox[aria-checked='true']"+ ).exists("sets the post type to whisper");+ await click(".composer-actions-trigger");await visit("/");assert.dom("#create-topic").exists("the create topic button is visible");await click("#create-topic");assert- .dom(".reply-details .whisper .d-icon-far-eye-slash")+ .dom(".composer-whisper-indicator.--whispering").doesNotExist("should reset the state of the composer's model");+ assert+ .dom(".save-or-cancel button .d-icon-far-eye-slash")+ .doesNotExist("the save button should not use the whisper icon");- await selectKit(".composer-actions").expand();- await selectKit(".composer-actions").selectRowByValue("toggle_unlisted");+ await click(".composer-actions-trigger");+ await click(".composer-toggle-unlisted .d-toggle-switch__checkbox");assert- .dom(".reply-details .unlist")- .includesText(i18n("composer.unlist"), "sets the topic to unlisted");+ .dom(+ ".composer-toggle-unlisted .d-toggle-switch__checkbox[aria-checked='true']"+ )+ .exists("sets the topic to unlisted");await visit("/t/this-is-a-test-topic/9");await click(".topic-post[data-post-number='1'] button.reply");assert- .dom(".reply-details .whisper")+ .dom(".composer-whisper-indicator.--whispering").doesNotExist("should reset the state of the composer's model");+ assert+ .dom(".composer-whisper-indicator.--public")+ .exists("the closed-state whisper indicator shows the reply is public");});- test("Composer can toggle whisper when switching from reply to whisper to reply to topic", async function (assert) {+ test("Composer whisper toggle not shown when replying to whisper", async function (assert) {await visit("/t/topic-with-whisper/960");await click(".topic-post[data-post-number='3'] button.reply");- await click(".reply-details summary div");+ await click(".composer-actions-trigger");assert- .dom('.reply-details li[data-value="toggle_whisper"]')- .doesNotExist("toggle whisper is not available when reply to whisper");- await click('.reply-details li[data-value="reply_to_topic"]');- await click(".reply-details summary div");+ .dom(".composer-toggle-whisper")+ .doesNotExist("whisper toggle is not available when reply to whisper");+ await click(".composer-actions-trigger");++ await click(".composer-actions-trigger");+ await click("[data-action-id='reply_to_topic']");++ await click(".composer-actions-trigger");assert- .dom('.reply-details li[data-value="toggle_whisper"]')- .exists("toggle whisper is available when reply to topic");+ .dom(".composer-toggle-whisper")+ .exists("whisper toggle is available when reply to topic");});- test("Composer can toggle whisper when clicking reply to topic after reply to whisper", async function (assert) {+ test("Composer whisper toggle available when replying to topic after whisper", async function (assert) {await visit("/t/topic-with-whisper/54081");await click(".topic-post[data-post-number='3'] button.reply");await click("#reply-control .discard-button");await click(".timeline-footer-controls button.create");- await click(".reply-details summary div");++ await click(".composer-actions-trigger");assert- .dom('.reply-details li[data-value="toggle_whisper"]')- .exists("toggle whisper is available when reply to topic");+ .dom(".composer-toggle-whisper")+ .exists("whisper toggle is available when reply to topic");});test("Composer restores whisper state from draft", async function (assert) {@@ -1389,14 +1461,16 @@ acceptance(`Composer`, function (needs) {await fillIn(".d-editor-input", longText);assert- .dom('.action-title a[href="/t/internationalization-localization/280"]')- .exists("the mode should be: reply to post");+ .dom(".composer-actions-trigger")+ .includesText(+ i18n("composer.composer_actions.reply_to_topic.trigger"),+ "the mode should be: reply to topic"+ );await click("article#post_3 button.reply");- const composerActions = selectKit(".composer-actions");- await composerActions.expand();- await composerActions.selectRowByValue("reply_as_new_topic");+ await click(".composer-actions-trigger");+ await click("[data-action-id='reply_as_new_topic']");assert.dom(".d-modal__body").doesNotExist("abandon popup shouldn't come");@@ -1405,8 +1479,11 @@ acceptance(`Composer`, function (needs) {.includesValue(longText, "entered text should still be there");assert- .dom('.action-title a[href="/t/internationalization-localization/280"]')- .doesNotExist("mode should have changed");+ .dom(".composer-actions-trigger")+ .includesText(+ i18n("composer.composer_actions.create_topic.label"),+ "mode should have changed to create topic"+ );});test("Does not replace recipient when another draft exists", async function (assert) {@@ -1601,12 +1678,17 @@ acceptance(`Composer - Customizations`, function (needs) {test("Supports text customization", async function (assert) {await visit("/");await click("#create-topic");- assert.dom(".action-title").hasText(i18n("topic.create_long"));+ assert+ .dom(".composer-actions-trigger")+ .includesText(+ i18n("composer.composer_actions.create_topic.label"),+ "trigger shows create topic label"+ );assert.dom(".save-or-cancel button").hasText(i18n("composer.create_topic"));const tags = selectKit(".mini-tag-chooser");await tags.expand();await tags.selectRowByName("monkey");- assert.dom(".action-title").hasText("custom text");+ assert.dom(".composer-actions-trigger").includesText("custom text");assert.dom(".save-or-cancel button").hasText(i18n("composer.emoji"));});});@@ -2077,7 +2159,7 @@ acceptance(`composer buttons API`, function (needs) {await visit("/t/34");await click("article#post_3 button.reply");- assert.dom(".reply-details .user-link").hasText("NewNameHere");+ assert.dom(".composer-actions-trigger").includesText("NewNameHere");});test("modified avatar when replying to a post", async function (assert) {@@ -2093,13 +2175,11 @@ acceptance(`composer buttons API`, function (needs) {await visit("/t/34");await click("article#post_3 button.reply");- assert- .dom(".reply-details .action-title img")- .hasAttribute(- "src",- /\/images\/avatar\.png/,- "Reply avatar can be customized"- );+ const composer = this.owner.lookup("service:composer");+ assert.true(+ composer.model.replyOptions.userAvatar.includes("/images/avatar.png"),+ "reply avatar can be customized"+ );});test("modified avatar in quote", async function (assert) {diff --git a/frontend/discourse/tests/acceptance/keyboard-shortcuts-new-test.js b/frontend/discourse/tests/acceptance/keyboard-shortcuts-new-test.jsdeleted file mode 100644index a4fbe02acc5..00000000000--- a/frontend/discourse/tests/acceptance/keyboard-shortcuts-new-test.js+++ /dev/null@@ -1,52 +0,0 @@-import { triggerKeyEvent, visit } from "@ember/test-helpers";-import { module, test } from "qunit";-import { acceptance } from "discourse/tests/helpers/qunit-helpers";-import { i18n } from "discourse-i18n";--acceptance(- "Keyboard Shortcuts - Authenticated Users (new composer actions)",- function (needs) {- needs.user();- needs.settings({- enable_new_composer_actions: true,- });-- module("context aware create new shortcuts", function () {- test("C key opens composer in new topic mode from topics list", async function (assert) {- await visit("/");- await triggerKeyEvent(document, "keypress", "C");-- assert- .dom(".composer-action-create-topic .composer-actions-trigger")- .includesText(- i18n("composer.composer_actions.create_topic.label"),- "composer shows create topic title"- );- });-- test("C key opens composer in new PM mode from messages list", async function (assert) {- await visit("/my/messages");- await triggerKeyEvent(document, "keypress", "C");-- assert- .dom(".composer-action-private-message .composer-actions-trigger")- .includesText(- i18n("composer.composer_actions.create_personal_message.label"),- "composer shows create message title"- );- });-- test("C key opens composer in new PM mode from PM topic", async function (assert) {- await visit("/t/pm-for-testing/12");- await triggerKeyEvent(document, "keypress", "C");-- assert- .dom(".composer-action-private-message .composer-actions-trigger")- .includesText(- i18n("composer.composer_actions.create_personal_message.label"),- "composer shows create message title"- );- });- });- }-);diff --git a/frontend/discourse/tests/acceptance/keyboard-shortcuts-test.js b/frontend/discourse/tests/acceptance/keyboard-shortcuts-test.jsindex b5a72941608..a6481b3bd79 100644--- a/frontend/discourse/tests/acceptance/keyboard-shortcuts-test.js+++ b/frontend/discourse/tests/acceptance/keyboard-shortcuts-test.js@@ -294,9 +294,9 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {await triggerKeyEvent(document, "keypress", "C");assert- .dom(".composer-action-create-topic .composer-action-title")+ .dom(".composer-action-create-topic .composer-actions-trigger").includesText(- i18n("composer.composer_actions.create_topic.desc"),+ i18n("composer.composer_actions.create_topic.label"),"composer shows create topic title");});@@ -306,9 +306,9 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {await triggerKeyEvent(document, "keypress", "C");assert- .dom(".composer-action-private-message .composer-action-title")+ .dom(".composer-action-private-message .composer-actions-trigger").includesText(- i18n("topic.private_message"),+ i18n("composer.composer_actions.create_personal_message.label"),"composer shows create message title");});@@ -318,9 +318,9 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) {await triggerKeyEvent(document, "keypress", "C");assert- .dom(".composer-action-private-message .composer-action-title")+ .dom(".composer-action-private-message .composer-actions-trigger").includesText(- i18n("topic.private_message"),+ i18n("composer.composer_actions.create_personal_message.label"),"composer shows create message title");});diff --git a/frontend/discourse/tests/helpers/qunit-helpers.js b/frontend/discourse/tests/helpers/qunit-helpers.jsindex c4b18f09e07..212e63f1e44 100644--- a/frontend/discourse/tests/helpers/qunit-helpers.js+++ b/frontend/discourse/tests/helpers/qunit-helpers.js@@ -44,6 +44,7 @@ import { resetAdminPluginConfigNav } from "discourse/lib/admin-plugin-config-navimport { clearPluginHeaderActionComponents } from "discourse/lib/admin-plugin-header-actions";import { resetAdditionalReportModes } from "discourse/lib/admin-report-additional-modes";import { rollbackAllPrepends } from "discourse/lib/class-prepend";+import { _clearRegisteredActions } from "discourse/lib/composer/actions-registry";import { clearPopupMenuOptions } from "discourse/lib/composer/custom-popup-menu-options";import deprecated, { clearBacklog } from "discourse/lib/deprecated";import { clearDesktopNotificationHandlers } from "discourse/lib/desktop-notifications";@@ -94,7 +95,6 @@ import Site from "discourse/models/site";import { clearAddedTrackedTopicProperties } from "discourse/models/topic";import User from "discourse/models/user";import { clearResolverOptions } from "discourse/resolver";-import { _clearSnapshots as _clearComposerActionsSnapshotsOld } from "discourse/select-kit/components/composer-actions";import { enableClearA11yAnnouncementsInTests } from "discourse/services/a11y";import {clearDisabledDefaultKeyboardBindings,@@ -236,7 +236,7 @@ export function testCleanup(container, app) {clearNavItems();setTopicList(null);container?.lookup?.("service:composer-action-state")?.clear();- _clearComposerActionsSnapshotsOld();+ _clearRegisteredActions();cleanUpComposerUploadHandler();cleanUpComposerUploadMarkdownResolver();cleanUpComposerUploadPreProcessor();diff --git a/plugins/discourse-events/spec/system/composer/create_event_action_spec.rb b/plugins/discourse-events/spec/system/composer/create_event_action_spec.rbindex 9226972179e..dceb07d1b0f 100644--- a/plugins/discourse-events/spec/system/composer/create_event_action_spec.rb+++ b/plugins/discourse-events/spec/system/composer/create_event_action_spec.rb@@ -59,7 +59,7 @@ describe "Composer - Create event action" doI18n.t("js.discourse_post_event.composer.create_event_button"),)- composer.open_composer_actions_new+ composer.open_composer_actionscomposer.select_action_by_id("create_regular_topic")expect(composer.button_label).to have_text(I18n.t("js.composer.create_topic"))diff --git a/plugins/discourse-events/test/javascripts/acceptance/create-event-composer-action-test.js b/plugins/discourse-events/test/javascripts/acceptance/create-event-composer-action-test.jsindex 3b2c4ec922a..a13897d9606 100644--- a/plugins/discourse-events/test/javascripts/acceptance/create-event-composer-action-test.js+++ b/plugins/discourse-events/test/javascripts/acceptance/create-event-composer-action-test.js@@ -82,50 +82,43 @@ acceptance("Create event composer action", function (needs) {await visit("/");await click("#create-topic");const categoryChooser = selectKit(".category-chooser");- const composerActions = selectKit(".composer-actions");// Non-events category — neither plugin option appearsawait categoryChooser.expand();await categoryChooser.selectRowByValue(1);- await composerActions.expand();+ await click(".composer-actions-trigger");assert- .dom(`.composer-actions .select-kit-row[data-value="create_event"]`)+ .dom(".composer-actions-dropdown [data-action-id='create_event']").doesNotExist();assert- .dom(- `.composer-actions .select-kit-row[data-value="create_regular_topic"]`- )+ .dom(".composer-actions-dropdown [data-action-id='create_regular_topic']").doesNotExist();- await composerActions.collapse();+ await click(".composer-actions-trigger");// Events-type category — auto-enters event mode; Create topic switch-back appearsawait categoryChooser.expand();await categoryChooser.selectRowByValue(2);- await composerActions.expand();+ await click(".composer-actions-trigger");assert- .dom(`.composer-actions .select-kit-row[data-value="create_event"]`)+ .dom(".composer-actions-dropdown [data-action-id='create_event']").doesNotExist();assert- .dom(- `.composer-actions .select-kit-row[data-value="create_regular_topic"]`- )+ .dom(".composer-actions-dropdown [data-action-id='create_regular_topic']").exists();// Picking Create topic exits event mode and surfaces Create event- await composerActions.selectRowByValue("create_regular_topic");+ await click("[data-action-id='create_regular_topic']");assert.dom(".d-editor-input").hasNoValue("skeleton is cleared on exit");assert.dom(".save-or-cancel button.create").hasText(i18n("composer.create_topic"));- await composerActions.expand();+ await click(".composer-actions-trigger");assert- .dom(`.composer-actions .select-kit-row[data-value="create_event"]`)+ .dom(".composer-actions-dropdown [data-action-id='create_event']").exists();assert- .dom(- `.composer-actions .select-kit-row[data-value="create_regular_topic"]`- )+ .dom(".composer-actions-dropdown [data-action-id='create_regular_topic']").doesNotExist();});@@ -256,10 +249,9 @@ acceptance("Create event composer action", function (needs) {.dom(".save-or-cancel button.create").hasText(i18n("composer.create_topic"), "stays in topic mode");- const composerActions = selectKit(".composer-actions");- await composerActions.expand();+ await click(".composer-actions-trigger");assert- .dom(`.composer-actions .select-kit-row[data-value="create_event"]`)+ .dom(".composer-actions-dropdown [data-action-id='create_event']").exists("Create event is still offered as an explicit opt-in");});@@ -322,14 +314,13 @@ acceptance(.dom(".save-or-cancel button.create").hasText(i18n("composer.create_topic"));- const composerActions = selectKit(".composer-actions");- await composerActions.expand();+ await click(".composer-actions-trigger");assert- .dom(`.composer-actions .select-kit-row[data-value="create_event"]`)+ .dom(".composer-actions-dropdown [data-action-id='create_event']").doesNotExist("Create event option is not offered");assert.dom(- `.composer-actions .select-kit-row[data-value="create_regular_topic"]`+ ".composer-actions-dropdown [data-action-id='create_regular_topic']").doesNotExist();});diff --git a/plugins/discourse-post-voting/assets/javascripts/discourse/initializers/extend-composer-actions.js b/plugins/discourse-post-voting/assets/javascripts/discourse/initializers/extend-composer-actions.jsindex 052b9d06b1e..0d5d2d6aae0 100644--- a/plugins/discourse-post-voting/assets/javascripts/discourse/initializers/extend-composer-actions.js+++ b/plugins/discourse-post-voting/assets/javascripts/discourse/initializers/extend-composer-actions.js@@ -41,55 +41,6 @@ export default {},});- api.modifyClass("component:composer-actions", {- pluginId: "discourse-post-voting",-- togglePostVotingSelected(options, model) {- model.toggleProperty("createAsPostVoting");- model.notifyPropertyChange("replyOptions");- model.notifyPropertyChange("action");- },- });-- api.modifySelectKit("composer-actions").appendContent((options) => {- if (options.action === CREATE_TOPIC) {- if (- options.composerModel.createAsPostVoting &&- !options.composerModel.onlyPostVotingInThisCategory- ) {- return [- {- name: i18n(- "composer.composer_actions.remove_as_post_voting.label"- ),- description: i18n(- "composer.composer_actions.remove_as_post_voting.desc"- ),- icon: "plus",- id: "togglePostVoting",- },- ];- } else if (options.composerModel.onlyPostVotingInThisCategory) {- return [];- } else {- return [- {- name: i18n(- "composer.composer_actions.create_as_post_voting.label"- ),- description: i18n(- "composer.composer_actions.create_as_post_voting.desc"- ),- icon: "plus",- id: "togglePostVoting",- },- ];- }- } else {- return [];- }- });-api.registerValueTransformer("composer-actions-content",({ value, context }) => {diff --git a/plugins/discourse-post-voting/test/javascripts/acceptance/composer-new-test.js b/plugins/discourse-post-voting/test/javascripts/acceptance/composer-new-test.jsdeleted file mode 100644index b02b6423e0e..00000000000--- a/plugins/discourse-post-voting/test/javascripts/acceptance/composer-new-test.js+++ /dev/null@@ -1,119 +0,0 @@-import { click, fillIn, visit } from "@ember/test-helpers";-import { test } from "qunit";-import Category from "discourse/models/category";-import { parsePostData } from "discourse/tests/helpers/create-pretender";-import { acceptance } from "discourse/tests/helpers/qunit-helpers";-import selectKit from "discourse/tests/helpers/select-kit-helper";-import { i18n } from "discourse-i18n";--let createAsPostVotingSetInRequest = false;--acceptance("composer (new composer actions)", function (needs) {- needs.user();- needs.settings({- post_voting_enabled: true,- enable_new_composer_actions: true,- });-- needs.hooks.afterEach(function () {- createAsPostVotingSetInRequest = false;- });-- needs.pretender((server, helper) => {- server.post("/posts", (request) => {- const data = parsePostData(request.requestBody);- if (- String(data.create_as_post_voting) === "true" ||- String(data.only_post_voting_in_this_category) === "true"- ) {- createAsPostVotingSetInRequest = true;- }-- return helper.response({- post: {- topic_id: 280,- },- });- });- });-- test("Creating new topic with post voting format", async function (assert) {- await visit("/");- await click("#create-topic");-- const categoryChooser = selectKit(".category-chooser");- await categoryChooser.expand();- await categoryChooser.selectRowByValue(2);-- await click(".composer-actions-trigger");- await click("[data-action-id='togglePostVoting']");-- assert- .dom(".composer-actions-trigger")- .includesText(- i18n("composer.create_post_voting.label"),- "displays the right composer action title when creating Post Voting topic"- );-- assert- .dom(".create .d-button-label")- .hasText(- i18n("composer.create_post_voting.label"),- "displays the right label for composer create button"- );-- await click(".composer-actions-trigger");- await click("[data-action-id='togglePostVoting']");-- assert- .dom(".composer-actions-trigger")- .doesNotIncludeText(- i18n("composer.create_post_voting.label"),- "reverts to original composer title when post voting format is disabled"- );-- await click(".composer-actions-trigger");- await click("[data-action-id='togglePostVoting']");-- await fillIn("#reply-title", "this is some random topic title");- await fillIn(".d-editor-input", "this is some random body");- await click(".create");-- assert.true(- createAsPostVotingSetInRequest,- "submits the right request to create topic as Post Voting formatted"- );- });-- test("Creating new topic in category with Post Voting create default", async function (assert) {- Category.findById(2).set("create_as_post_voting_default", true);-- await visit("/");- await click("#create-topic");-- const categoryChooser = selectKit(".category-chooser");- await categoryChooser.expand();- await categoryChooser.selectRowByValue(2);-- assert- .dom(".composer-actions-trigger")- .includesText(i18n("composer.create_post_voting.label"));- });-- test("Creating new topic in category with only_post_voting_in_this_category enabled", async function (assert) {- const category = Category.findById(2);- category.set("only_post_voting_in_this_category", true);-- await visit("/");- await click("#create-topic");-- const categoryChooser = selectKit(".category-chooser");- await categoryChooser.expand();-- await categoryChooser.selectRowByValue(2);-- assert- .dom(".composer-actions-trigger")- .includesText(i18n("composer.create_post_voting.label"));- });-});diff --git a/plugins/discourse-post-voting/test/javascripts/acceptance/composer-test.js b/plugins/discourse-post-voting/test/javascripts/acceptance/composer-test.jsindex 99e17f09050..90e88e1ae89 100644--- a/plugins/discourse-post-voting/test/javascripts/acceptance/composer-test.js+++ b/plugins/discourse-post-voting/test/javascripts/acceptance/composer-test.js@@ -42,15 +42,12 @@ acceptance("composer", function (needs) {await categoryChooser.expand();await categoryChooser.selectRowByValue(2);- const composerActions = selectKit(".composer-actions");- await composerActions.expand();- await composerActions.selectKitSelectRowByName(- i18n("composer.composer_actions.create_as_post_voting.label")- );+ await click(".composer-actions-trigger");+ await click("[data-action-id='togglePostVoting']");assert- .dom(".action-title")- .hasText(+ .dom(".composer-actions-trigger")+ .includesText(i18n("composer.create_post_voting.label"),"displays the right composer action title when creating Post Voting topic");@@ -62,22 +59,18 @@ acceptance("composer", function (needs) {"displays the right label for composer create button");- await composerActions.expand();- await composerActions.selectKitSelectRowByName(- i18n("composer.composer_actions.remove_as_post_voting.label")- );+ await click(".composer-actions-trigger");+ await click("[data-action-id='togglePostVoting']");assert- .dom(".action-title")+ .dom(".composer-actions-trigger").doesNotIncludeText(i18n("composer.create_post_voting.label"),"reverts to original composer title when post voting format is disabled");- await composerActions.expand();- await composerActions.selectKitSelectRowByName(- i18n("composer.composer_actions.create_as_post_voting.label")- );+ await click(".composer-actions-trigger");+ await click("[data-action-id='togglePostVoting']");await fillIn("#reply-title", "this is some random topic title");await fillIn(".d-editor-input", "this is some random body");@@ -95,15 +88,13 @@ acceptance("composer", function (needs) {await visit("/");await click("#create-topic");- assert.dom(".action-title").hasText(i18n("topic.create_long"));-const categoryChooser = selectKit(".category-chooser");await categoryChooser.expand();await categoryChooser.selectRowByValue(2);assert- .dom(".action-title")- .hasText(i18n("composer.create_post_voting.label"));+ .dom(".composer-actions-trigger")+ .includesText(i18n("composer.create_post_voting.label"));});test("Creating new topic in category with only_post_voting_in_this_category enabled", async function (assert) {@@ -113,16 +104,13 @@ acceptance("composer", function (needs) {await visit("/");await click("#create-topic");- assert.dom(".action-title").hasText(i18n("topic.create_long"));-const categoryChooser = selectKit(".category-chooser");await categoryChooser.expand();await categoryChooser.selectRowByValue(2);- const newTopicType = selectKit(".dropdown-select-box");- await newTopicType.expand();+assert- .dom(".action-title")- .hasText(i18n("composer.create_post_voting.label"));+ .dom(".composer-actions-trigger")+ .includesText(i18n("composer.create_post_voting.label"));});});diff --git a/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-new-test.js b/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-new-test.jsdeleted file mode 100644index ae6c0ed0b90..00000000000--- a/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-new-test.js+++ /dev/null@@ -1,58 +0,0 @@-import { click, fillIn, visit } from "@ember/test-helpers";-import { test } from "qunit";-import User from "discourse/models/user";-import { presentUserIds } from "discourse/tests/helpers/presence-pretender";-import { acceptance } from "discourse/tests/helpers/qunit-helpers";--acceptance(- "Discourse Presence Plugin (new composer actions)",- function (needs) {- needs.user({ whisperer: true });- needs.settings({- enable_new_composer_actions: true,- });- needs.pretender((server, helper) => {- server.get("/drafts/topic_280.json", function () {- return helper.response(200, { draft: null });- });- });-- test("Uses whisper channel for whispers via actions dropdown", async function (assert) {- await visit("/t/internationalization-localization/280");-- await click("#topic-footer-buttons .btn.create");- assert.dom(".d-editor-input").exists("the composer input is visible");-- await fillIn(".d-editor-input", "this is the content of my reply");-- assert.deepEqual(- presentUserIds("/discourse-presence/reply/280"),- [User.current().id],- "publishes reply presence when typing"- );-- await click(".composer-actions-trigger");- await click(".composer-toggle-whisper .d-toggle-switch__checkbox");-- assert.deepEqual(- presentUserIds("/discourse-presence/reply/280"),- [],- "removes reply presence"- );-- assert.deepEqual(- presentUserIds("/discourse-presence/whisper/280"),- [User.current().id],- "adds whisper presence"- );-- await click("#reply-control button.create");-- assert.deepEqual(- presentUserIds("/discourse-presence/whisper/280"),- [],- "leaves whisper channel when composer closes"- );- });- }-);diff --git a/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js b/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.jsindex 81b6baa85e6..902faf1eedb 100644--- a/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js+++ b/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js@@ -107,9 +107,8 @@ acceptance("Discourse Presence Plugin", function (needs) {"publishes reply presence when typing");- const menu = selectKit(".composer-actions");- await menu.expand();- await menu.selectRowByValue("toggle_whisper");+ await click(".composer-actions-trigger");+ await click(".composer-toggle-whisper .d-toggle-switch__checkbox");assert.deepEqual(presentUserIds("/discourse-presence/reply/280"),diff --git a/public/images/upcoming_changes/enable_new_composer_actions.png b/public/images/upcoming_changes/enable_new_composer_actions.pngdeleted file mode 100644index 6b007c12e7f..00000000000Binary files a/public/images/upcoming_changes/enable_new_composer_actions.png and /dev/null differdiff --git a/spec/system/composer/drafts_spec.rb b/spec/system/composer/drafts_spec.rbindex 0cfb4e41e00..41e18c393c6 100644--- a/spec/system/composer/drafts_spec.rb+++ b/spec/system/composer/drafts_spec.rb@@ -435,7 +435,7 @@ describe "Composer - Drafts" doexpect(Draft.where(user: current_user).count).to eq(1)end- composer.open_composer_actions_new+ composer.open_composer_actionscomposer.select_action_by_id("reply_as_new_topic")expect(composer).to be_openeddiff --git a/spec/system/page_objects/components/composer.rb b/spec/system/page_objects/components/composer.rbindex ef4e208367e..ead1f3a2599 100644--- a/spec/system/page_objects/components/composer.rb+++ b/spec/system/page_objects/components/composer.rb@@ -39,11 +39,6 @@ module PageObjectsenddef open_composer_actions- find(".composer-action-title .btn").click- self- end-- def open_composer_actions_newfind(".composer-actions-trigger").clickselfenddiff --git a/spec/system/private_message_spec.rb b/spec/system/private_message_spec.rbindex 7be7163f5ab..73604c42a78 100644--- a/spec/system/private_message_spec.rb+++ b/spec/system/private_message_spec.rb@@ -29,7 +29,7 @@ describe "Private Message" dovisit "/new-topic"expect(composer).to be_opened- composer.open_composer_actions_new+ composer.open_composer_actionscomposer.select_action_by_id("create_private_message")expect(composer.button_label).to have_text(I18n.t("js.composer.create_pm"))@@ -41,7 +41,7 @@ describe "Private Message" dopm_post_obj.replyexpect(composer).to be_opened- composer.open_composer_actions_new+ composer.open_composer_actionsexpect(composer).to have_no_action_id("create_private_message")end@@ -50,12 +50,12 @@ describe "Private Message" doexpect(composer).to be_opened# Switch to personal message- composer.open_composer_actions_new+ composer.open_composer_actionscomposer.select_action_by_id("create_private_message")expect(composer.button_label).to have_text(I18n.t("js.composer.create_pm"))# Switch back to topic- composer.open_composer_actions_new+ composer.open_composer_actionscomposer.select_action_by_id("create_topic")expect(composer.button_label).to have_text(I18n.t("js.composer.create_topic"))enddiff --git a/themes/horizon/scss/composer.scss b/themes/horizon/scss/composer.scssindex 3dd7168fab1..6e88a68ec2d 100644--- a/themes/horizon/scss/composer.scss+++ b/themes/horizon/scss/composer.scss@@ -1,18 +1,5 @@@use "lib/viewport";-#reply-control- .select-kit.dropdown-select-box.composer-actions- .select-kit-header {- border: 1px solid var(--tertiary-700);- background: var(--secondary);-- &:hover {- .d-icon {- color: var(--accent-color);- }- }-}-#reply-control.hide-preview:not(.draft) {@include viewport.from(sm) {background: var(--d-content-background);