A platform for community discussion. Free, open, simple.
DEV: [gjs-codemod] apply codemod
David Taylor999ae73c7836
diff --git a/app/assets/javascripts/admin/addon/components/admin-form-row.gjs b/app/assets/javascripts/admin/addon/components/admin-form-row.gjsindex 77125175df5..4ad7d195ddc 100644--- a/app/assets/javascripts/admin/addon/components/admin-form-row.gjs+++ b/app/assets/javascripts/admin/addon/components/admin-form-row.gjs@@ -1,8 +1,8 @@import Component from "@ember/component";import { classNames } from "@ember-decorators/component";+import { eq } from "truth-helpers";import concatClass from "discourse/helpers/concat-class";import { i18n } from "discourse-i18n";-import eq from "truth-helpers/helpers/eq";@classNames("row")export default class AdminFormRow extends Component {diff --git a/app/assets/javascripts/admin/addon/components/admin-penalty-reason.gjs b/app/assets/javascripts/admin/addon/components/admin-penalty-reason.gjsindex 77e222c41da..d45cba9bb14 100644--- a/app/assets/javascripts/admin/addon/components/admin-penalty-reason.gjs+++ b/app/assets/javascripts/admin/addon/components/admin-penalty-reason.gjs@@ -2,12 +2,12 @@ import Component, { Textarea } from "@ember/component";import { action } from "@ember/object";import { equal } from "@ember/object/computed";import { tagName } from "@ember-decorators/component";+import { eq } from "truth-helpers";import TextField from "discourse/components/text-field";import htmlSafe from "discourse/helpers/html-safe";import discourseComputed from "discourse/lib/decorators";import { i18n } from "discourse-i18n";import ComboBox from "select-kit/components/combo-box";-import eq from "truth-helpers/helpers/eq";const CUSTOM_REASON_KEY = "custom";diff --git a/app/assets/javascripts/admin/addon/components/admin-penalty-similar-users.gjs b/app/assets/javascripts/admin/addon/components/admin-penalty-similar-users.gjsindex a8fc59876b0..702fe2d566d 100644--- a/app/assets/javascripts/admin/addon/components/admin-penalty-similar-users.gjs+++ b/app/assets/javascripts/admin/addon/components/admin-penalty-similar-users.gjs@@ -4,6 +4,7 @@ import { Input } from "@ember/component";import { fn, get, hash } from "@ember/helper";import { on } from "@ember/modifier";import { action } from "@ember/object";+import { not } from "truth-helpers";import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";import avatar from "discourse/helpers/avatar";import formatDuration from "discourse/helpers/format-duration";@@ -11,7 +12,6 @@ import htmlSafe from "discourse/helpers/html-safe";import number from "discourse/helpers/number";import { ajax } from "discourse/lib/ajax";import { i18n } from "discourse-i18n";-import not from "truth-helpers/helpers/not";export default class AdminPenaltySimilarUsers extends Component {@tracked isLoading;diff --git a/app/assets/javascripts/admin/addon/components/admin-theme-editor.gjs b/app/assets/javascripts/admin/addon/components/admin-theme-editor.gjsindex 2253aaeed2a..003e36a58ff 100644--- a/app/assets/javascripts/admin/addon/components/admin-theme-editor.gjs+++ b/app/assets/javascripts/admin/addon/components/admin-theme-editor.gjs@@ -6,6 +6,7 @@ import { action, computed } from "@ember/object";import { LinkTo } from "@ember/routing";import { next } from "@ember/runloop";import { service } from "@ember/service";+import { gt, lte } from "truth-helpers";import AceEditor from "discourse/components/ace-editor";import icon from "discourse/helpers/d-icon";import htmlSafe from "discourse/helpers/html-safe";@@ -13,8 +14,6 @@ import { fmt } from "discourse/lib/computed";import discourseComputed from "discourse/lib/decorators";import { isDocumentRTL } from "discourse/lib/text-direction";import { i18n } from "discourse-i18n";-import gt from "truth-helpers/helpers/gt";-import lte from "truth-helpers/helpers/lte";const JS_DEFAULT_VALUE = `import { apiInitializer } from "discourse/lib/api";diff --git a/app/assets/javascripts/admin/addon/components/emoji-value-list.gjs b/app/assets/javascripts/admin/addon/components/emoji-value-list.gjsindex e12c191c394..316580523f9 100644--- a/app/assets/javascripts/admin/addon/components/emoji-value-list.gjs+++ b/app/assets/javascripts/admin/addon/components/emoji-value-list.gjs@@ -5,13 +5,13 @@ import { action, set, setProperties } from "@ember/object";import { schedule } from "@ember/runloop";import { service } from "@ember/service";import { classNameBindings } from "@ember-decorators/component";+import { not } from "truth-helpers";import DButton from "discourse/components/d-button";import EmojiPicker from "discourse/components/emoji-picker";import EmojiPickerDetached from "discourse/components/emoji-picker/detached";import discourseComputed from "discourse/lib/decorators";import { emojiUrlFor } from "discourse/lib/text";import { i18n } from "discourse-i18n";-import not from "truth-helpers/helpers/not";@classNameBindings(":value-list", ":emoji-list")export default class EmojiValueList extends Component {diff --git a/app/assets/javascripts/admin/addon/components/modal/penalize-user.gjs b/app/assets/javascripts/admin/addon/components/modal/penalize-user.gjsindex d825d366c37..fda56881efd 100644--- a/app/assets/javascripts/admin/addon/components/modal/penalize-user.gjs+++ b/app/assets/javascripts/admin/addon/components/modal/penalize-user.gjs@@ -4,6 +4,7 @@ import { fn } from "@ember/helper";import { action } from "@ember/object";import { service } from "@ember/service";import { isEmpty } from "@ember/utils";+import { eq } from "truth-helpers";import DButton from "discourse/components/d-button";import DModal from "discourse/components/d-modal";import FutureDateInput from "discourse/components/future-date-input";@@ -13,7 +14,6 @@ import I18n, { i18n } from "discourse-i18n";import AdminPenaltyPostAction from "admin/components/admin-penalty-post-action";import AdminPenaltyReason from "admin/components/admin-penalty-reason";import AdminPenaltySimilarUsers from "admin/components/admin-penalty-similar-users";-import eq from "truth-helpers/helpers/eq";export default class PenalizeUser extends Component {@service dialog;diff --git a/app/assets/javascripts/admin/addon/components/simple-list.gjs b/app/assets/javascripts/admin/addon/components/simple-list.gjsindex 30623b83d9e..27b825f7683 100644--- a/app/assets/javascripts/admin/addon/components/simple-list.gjs+++ b/app/assets/javascripts/admin/addon/components/simple-list.gjs@@ -6,11 +6,11 @@ import { action } from "@ember/object";import { empty } from "@ember/object/computed";import { isEmpty } from "@ember/utils";import { classNameBindings } from "@ember-decorators/component";+import { gt } from "truth-helpers";import DButton from "discourse/components/d-button";import discourseComputed from "discourse/lib/decorators";import { i18n } from "discourse-i18n";import ComboBox from "select-kit/components/combo-box";-import gt from "truth-helpers/helpers/gt";@classNameBindings(":simple-list", ":value-list")export default class SimpleList extends Component {diff --git a/app/assets/javascripts/admin/addon/components/themes-list.gjs b/app/assets/javascripts/admin/addon/components/themes-list.gjsindex ec0b0b3c74f..33fed56b321 100644--- a/app/assets/javascripts/admin/addon/components/themes-list.gjs+++ b/app/assets/javascripts/admin/addon/components/themes-list.gjs@@ -5,6 +5,7 @@ import { action } from "@ember/object";import { equal, gt, gte } from "@ember/object/computed";import { service } from "@ember/service";import { classNames } from "@ember-decorators/component";+import { and, eq, not, or } from "truth-helpers";import DButton from "discourse/components/d-button";import DeleteThemesConfirm from "discourse/components/modal/delete-themes-confirm";import concatClass from "discourse/helpers/concat-class";@@ -14,10 +15,6 @@ import { i18n } from "discourse-i18n";import ThemesListItem from "admin/components/themes-list-item";import { COMPONENTS, THEMES } from "admin/models/theme";import ComboBox from "select-kit/components/combo-box";-import and from "truth-helpers/helpers/and";-import eq from "truth-helpers/helpers/eq";-import not from "truth-helpers/helpers/not";-import or from "truth-helpers/helpers/or";const ALL_FILTER = "all";const ACTIVE_FILTER = "active";diff --git a/app/assets/javascripts/admin/addon/components/webhook-events.gjs b/app/assets/javascripts/admin/addon/components/webhook-events.gjsindex a7ddd9b809f..3c7e308d713 100644--- a/app/assets/javascripts/admin/addon/components/webhook-events.gjs+++ b/app/assets/javascripts/admin/addon/components/webhook-events.gjs@@ -8,6 +8,7 @@ import didInsert from "@ember/render-modifiers/modifiers/did-insert";import didUpdate from "@ember/render-modifiers/modifiers/did-update";import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";import { service } from "@ember/service";+import { not } from "truth-helpers";import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";import CountI18n from "discourse/components/count-i18n";import DButton from "discourse/components/d-button";@@ -18,7 +19,6 @@ import { bind } from "discourse/lib/decorators";import { i18n } from "discourse-i18n";import WebhookEvent from "admin/components/webhook-event";import ComboBox from "select-kit/components/combo-box";-import not from "truth-helpers/helpers/not";export default class WebhookEvents extends Component {@service messageBus;diff --git a/app/assets/javascripts/admin/addon/templates/customize-themes.gjs b/app/assets/javascripts/admin/addon/templates/customize-themes.gjsindex b89aa12c49f..1216371a238 100644--- a/app/assets/javascripts/admin/addon/templates/customize-themes.gjs+++ b/app/assets/javascripts/admin/addon/templates/customize-themes.gjs@@ -1,12 +1,11 @@import RouteTemplate from "ember-route-template";+import { eq, or } from "truth-helpers";import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";import DPageHeader from "discourse/components/d-page-header";import PluginOutlet from "discourse/components/plugin-outlet";import routeAction from "discourse/helpers/route-action";import { i18n } from "discourse-i18n";import ThemesList from "admin/components/themes-list";-import eq from "truth-helpers/helpers/eq";-import or from "truth-helpers/helpers/or";export default RouteTemplate(<template>diff --git a/app/assets/javascripts/admin/addon/templates/email-sent.gjs b/app/assets/javascripts/admin/addon/templates/email-sent.gjsindex b100dbc82f5..7b546ad7a00 100644--- a/app/assets/javascripts/admin/addon/templates/email-sent.gjs+++ b/app/assets/javascripts/admin/addon/templates/email-sent.gjs@@ -1,6 +1,7 @@import { fn } from "@ember/helper";import { LinkTo } from "@ember/routing";import RouteTemplate from "ember-route-template";+import { gt } from "truth-helpers";import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";import LoadMore from "discourse/components/load-more";import TextField from "discourse/components/text-field";@@ -10,7 +11,6 @@ import formatDate from "discourse/helpers/format-date";import slice from "discourse/helpers/slice";import { i18n } from "discourse-i18n";import DTooltip from "float-kit/components/d-tooltip";-import gt from "truth-helpers/helpers/gt";export default RouteTemplate(<template>diff --git a/app/assets/javascripts/admin/addon/templates/user-index.gjs b/app/assets/javascripts/admin/addon/templates/user-index.gjsindex add1151e730..14d46b10c14 100644--- a/app/assets/javascripts/admin/addon/templates/user-index.gjs+++ b/app/assets/javascripts/admin/addon/templates/user-index.gjs@@ -1,6 +1,7 @@import { fn, hash } from "@ember/helper";import { LinkTo } from "@ember/routing";import RouteTemplate from "ember-route-template";+import { and, gt } from "truth-helpers";import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";import DButton from "discourse/components/d-button";import PluginOutlet from "discourse/components/plugin-outlet";@@ -17,8 +18,6 @@ import AdminUserExportsTable from "admin/components/admin-user-exports-table";import IpLookup from "admin/components/ip-lookup";import ComboBox from "select-kit/components/combo-box";import GroupChooser from "select-kit/components/group-chooser";-import and from "truth-helpers/helpers/and";-import gt from "truth-helpers/helpers/gt";export default RouteTemplate(<template>diff --git a/app/assets/javascripts/admin/addon/templates/users-list-show.gjs b/app/assets/javascripts/admin/addon/templates/users-list-show.gjsindex c2d9fbb4e7f..bc9cb2fa391 100644--- a/app/assets/javascripts/admin/addon/templates/users-list-show.gjs+++ b/app/assets/javascripts/admin/addon/templates/users-list-show.gjs@@ -2,6 +2,7 @@ import { concat, fn, get, hash } from "@ember/helper";import { on } from "@ember/modifier";import { LinkTo } from "@ember/routing";import RouteTemplate from "ember-route-template";+import { eq, not, or } from "truth-helpers";import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";import DButton from "discourse/components/d-button";import DPageSubheader from "discourse/components/d-page-subheader";@@ -21,9 +22,6 @@ import rawDate from "discourse/helpers/raw-date";import { i18n } from "discourse-i18n";import DMenu from "float-kit/components/d-menu";import DTooltip from "float-kit/components/d-tooltip";-import eq from "truth-helpers/helpers/eq";-import not from "truth-helpers/helpers/not";-import or from "truth-helpers/helpers/or";export default RouteTemplate(<template>diff --git a/app/assets/javascripts/discourse/tests/integration/helpers/d-icon-test.gjs b/app/assets/javascripts/discourse/tests/integration/helpers/d-icon-test.gjsindex eda7cdf3e5b..4fea84f1842 100644--- a/app/assets/javascripts/discourse/tests/integration/helpers/d-icon-test.gjs+++ b/app/assets/javascripts/discourse/tests/integration/helpers/d-icon-test.gjs@@ -1,6 +1,6 @@import { render } from "@ember/test-helpers";import { module, test } from "qunit";-import dIcon from "discourse/helpers/d-icon";+import icon from "discourse/helpers/d-icon";import { setupRenderingTest } from "discourse/tests/helpers/component-test";module("Integration | Helper | d-icon", function (hooks) {@@ -9,7 +9,7 @@ module("Integration | Helper | d-icon", function (hooks) {test("default", async function (assert) {await render(<template>- <div class="test">{{dIcon "bars"}}</div>+ <div class="test">{{icon "bars"}}</div></template>);@@ -23,7 +23,7 @@ module("Integration | Helper | d-icon", function (hooks) {test("with replacement", async function (assert) {await render(<template>- <div class="test">{{dIcon "d-watching"}}</div>+ <div class="test">{{icon "d-watching"}}</div></template>);diff --git a/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/edit.gjs b/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/edit.gjsindex 4a47bdc1345..d118fbff608 100644--- a/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/edit.gjs+++ b/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/edit.gjs@@ -1,14 +1,24 @@-<div class="admin-detail discourse-chat-incoming-webhooks">- <BackButton- @label="chat.incoming_webhooks.back"- @route="adminPlugins.show.discourse-chat-incoming-webhooks.index"- class="incoming-chat-webhooks-back"- />+import RouteTemplate from "ember-route-template";+import { not } from "truth-helpers";+import BackButton from "discourse/components/back-button";+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";+import ChatIncomingWebhookEditForm from "discourse/plugins/chat/admin/components/chat-incoming-webhook-edit-form";- <ConditionalLoadingSpinner @condition={{not this.model.webhook}}>- <ChatIncomingWebhookEditForm- @webhook={{this.model.webhook}}- @chatChannels={{this.model.chat_channels}}- />- </ConditionalLoadingSpinner>-</div>\ No newline at end of file+export default RouteTemplate(+ <template>+ <div class="admin-detail discourse-chat-incoming-webhooks">+ <BackButton+ @label="chat.incoming_webhooks.back"+ @route="adminPlugins.show.discourse-chat-incoming-webhooks.index"+ class="incoming-chat-webhooks-back"+ />++ <ConditionalLoadingSpinner @condition={{not @controller.model.webhook}}>+ <ChatIncomingWebhookEditForm+ @webhook={{@controller.model.webhook}}+ @chatChannels={{@controller.model.chat_channels}}+ />+ </ConditionalLoadingSpinner>+ </div>+ </template>+);diff --git a/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/index.gjs b/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/index.gjsindex 9de338163f6..39ee76c303a 100644--- a/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/index.gjs+++ b/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/index.gjs@@ -1,32 +1,42 @@-<DBreadcrumbsItem- @path="/admin/plugins/chat/hooks"- @label={{i18n "chat.incoming_webhooks.title"}}-/>+import RouteTemplate from "ember-route-template";+import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";+import DPageSubheader from "discourse/components/d-page-subheader";+import { i18n } from "discourse-i18n";+import AdminChatIncomingWebhooksList from "discourse/plugins/chat/admin/components/admin-chat-incoming-webhooks-list";-<div class="discourse-chat-incoming-webhooks admin-detail">- <DPageSubheader- @titleLabel={{i18n "chat.incoming_webhooks.title"}}- @descriptionLabel={{i18n "chat.incoming_webhooks.instructions"}}- >- <:actions as |actions|>- <actions.Primary- @label="chat.incoming_webhooks.new"- @title="chat.incoming_webhooks.new"- @route="adminPlugins.show.discourse-chat-incoming-webhooks.new"- @routeModels="chat"- @icon="plus"- class="admin-incoming-webhooks-new"- />- </:actions>- </DPageSubheader>+export default RouteTemplate(+ <template>+ <DBreadcrumbsItem+ @path="/admin/plugins/chat/hooks"+ @label={{i18n "chat.incoming_webhooks.title"}}+ />- <div class="incoming-chat-webhooks">- {{#if this.model.incoming_chat_webhooks}}- <AdminChatIncomingWebhooksList- @webhooks={{this.model.incoming_chat_webhooks}}- />- {{else}}- {{i18n "chat.incoming_webhooks.none"}}- {{/if}}- </div>-</div>\ No newline at end of file+ <div class="discourse-chat-incoming-webhooks admin-detail">+ <DPageSubheader+ @titleLabel={{i18n "chat.incoming_webhooks.title"}}+ @descriptionLabel={{i18n "chat.incoming_webhooks.instructions"}}+ >+ <:actions as |actions|>+ <actions.Primary+ @label="chat.incoming_webhooks.new"+ @title="chat.incoming_webhooks.new"+ @route="adminPlugins.show.discourse-chat-incoming-webhooks.new"+ @routeModels="chat"+ @icon="plus"+ class="admin-incoming-webhooks-new"+ />+ </:actions>+ </DPageSubheader>++ <div class="incoming-chat-webhooks">+ {{#if @controller.model.incoming_chat_webhooks}}+ <AdminChatIncomingWebhooksList+ @webhooks={{@controller.model.incoming_chat_webhooks}}+ />+ {{else}}+ {{i18n "chat.incoming_webhooks.none"}}+ {{/if}}+ </div>+ </div>+ </template>+);diff --git a/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/new.gjs b/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/new.gjsindex 5fc3a1706b4..fc0f311b45c 100644--- a/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/new.gjs+++ b/plugins/chat/admin/assets/javascripts/discourse/templates/admin-plugins/show/discourse-chat-incoming-webhooks/new.gjs@@ -1,9 +1,19 @@-<div class="admin-detail discourse-chat-incoming-webhooks">- <BackButton- @label="chat.incoming_webhooks.back"- @route="adminPlugins.show.discourse-chat-incoming-webhooks.index"- class="incoming-chat-webhooks-back"- />+import RouteTemplate from "ember-route-template";+import BackButton from "discourse/components/back-button";+import ChatIncomingWebhookEditForm from "discourse/plugins/chat/admin/components/chat-incoming-webhook-edit-form";- <ChatIncomingWebhookEditForm @chatChannels={{this.model.chat_channels}} />-</div>\ No newline at end of file+export default RouteTemplate(+ <template>+ <div class="admin-detail discourse-chat-incoming-webhooks">+ <BackButton+ @label="chat.incoming_webhooks.back"+ @route="adminPlugins.show.discourse-chat-incoming-webhooks.index"+ class="incoming-chat-webhooks-back"+ />++ <ChatIncomingWebhookEditForm+ @chatChannels={{@controller.model.chat_channels}}+ />+ </div>+ </template>+);diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-chooser-header.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-chooser-header.gjsindex 4d1059e34e5..493a813c202 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-chooser-header.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-chooser-header.gjs@@ -1,13 +1,18 @@+import icon from "discourse/helpers/d-icon";+import { i18n } from "discourse-i18n";import ComboBoxSelectBoxHeaderComponent from "select-kit/components/combo-box/combo-box-header";+import ChannelTitle from "discourse/plugins/chat/discourse/components/channel-title";-export default class ChatChannelChooserHeader extends ComboBoxSelectBoxHeaderComponent {}+export default class ChatChannelChooserHeader extends ComboBoxSelectBoxHeaderComponent {+ <template>+ <div class="select-kit-header-wrapper">+ {{#if this.selectedContent}}+ <ChannelTitle @channel={{this.selectedContent}} />+ {{else}}+ {{i18n "chat.incoming_webhooks.channel_placeholder"}}+ {{/if}}-<div class="select-kit-header-wrapper">- {{#if this.selectedContent}}- <ChannelTitle @channel={{this.selectedContent}} />- {{else}}- {{i18n "chat.incoming_webhooks.channel_placeholder"}}- {{/if}}-- {{d-icon this.caretIcon class="caret-icon"}}-</div>\ No newline at end of file+ {{icon this.caretIcon class="caret-icon"}}+ </div>+ </template>+}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-chooser-row.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-chooser-row.gjsindex 645d189b074..3a7c6b3d928 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-chooser-row.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-chooser-row.gjs@@ -1,7 +1,8 @@import { classNames } from "@ember-decorators/component";import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";+import ChannelTitle from "discourse/plugins/chat/discourse/components/channel-title";@classNames("chat-channel-chooser-row")-export default class ChatChannelChooserRow extends SelectKitRowComponent {}--<ChannelTitle @channel={{this.item}} />\ No newline at end of file+export default class ChatChannelChooserRow extends SelectKitRowComponent {+ <template><ChannelTitle @channel={{this.item}} /></template>+}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer-uploads.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-composer-uploads.gjsindex 448c4a97959..a2c53097324 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-composer-uploads.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer-uploads.gjs@@ -1,13 +1,16 @@import Component from "@ember/component";+import { fn } from "@ember/helper";import { action } from "@ember/object";import { getOwner } from "@ember/owner";import { service } from "@ember/service";import { classNames } from "@ember-decorators/component";+import PickFilesButton from "discourse/components/pick-files-button";import { bind } from "discourse/lib/decorators";import { cloneJSON } from "discourse/lib/object";import UppyUpload from "discourse/lib/uppy/uppy-upload";import UppyMediaOptimization from "discourse/lib/uppy-media-optimization-plugin";import { clipboardHelpers } from "discourse/lib/utilities";+import ChatComposerUpload from "discourse/plugins/chat/discourse/components/chat-composer-upload";@classNames("chat-composer-uploads")export default class ChatComposerUploads extends Component {@@ -137,30 +140,32 @@ export default class ChatComposerUploads extends Component {inProgressUploadsCount: this.inProgressUploads?.length,});}-}-{{#if this.showUploadsContainer}}- <div class="chat-composer-uploads-container">- {{#each this.uploads as |upload|}}- <ChatComposerUpload- @upload={{upload}}- @isDone={{true}}- @onCancel={{action "removeUpload" upload}}- />- {{/each}}-- {{#each this.inProgressUploads as |upload|}}- <ChatComposerUpload- @upload={{upload}}- @onCancel={{action "cancelUploading" upload}}- />- {{/each}}- </div>-{{/if}}--<PickFilesButton- @allowMultiple={{true}}- @fileInputId={{this.fileUploadElementId}}- @fileInputClass="hidden-upload-field"- @registerFileInput={{this.uppyUpload.setup}}-/>\ No newline at end of file+ <template>+ {{#if this.showUploadsContainer}}+ <div class="chat-composer-uploads-container">+ {{#each this.uploads as |upload|}}+ <ChatComposerUpload+ @upload={{upload}}+ @isDone={{true}}+ @onCancel={{fn this.removeUpload upload}}+ />+ {{/each}}++ {{#each this.inProgressUploads as |upload|}}+ <ChatComposerUpload+ @upload={{upload}}+ @onCancel={{fn this.cancelUploading upload}}+ />+ {{/each}}+ </div>+ {{/if}}++ <PickFilesButton+ @allowMultiple={{true}}+ @fileInputId={{this.fileUploadElementId}}+ @fileInputClass="hidden-upload-field"+ @registerFileInput={{this.uppyUpload.setup}}+ />+ </template>+}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjsindex 70ab56b80e5..a9c5acf5884 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs@@ -1,7 +1,12 @@import Component from "@glimmer/component";import { tracked } from "@glimmer/tracking";+import { fn, hash } from "@ember/helper";+import { on } from "@ember/modifier";import { action } from "@ember/object";import { getOwner } from "@ember/owner";+import didInsert from "@ember/render-modifiers/modifiers/did-insert";+import didUpdate from "@ember/render-modifiers/modifiers/did-update";+import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";import { cancel, next } from "@ember/runloop";import { service } from "@ember/service";import { isPresent } from "@ember/utils";@@ -13,8 +18,12 @@ import {} from "pretty-text/emoji";import { replacements, translations } from "pretty-text/emoji/data";import { Promise } from "rsvp";+import { not, or } from "truth-helpers";+import DTextarea from "discourse/components/d-textarea";import EmojiPickerDetached from "discourse/components/emoji-picker/detached";import InsertHyperlink from "discourse/components/modal/insert-hyperlink";+import PluginOutlet from "discourse/components/plugin-outlet";+import concatClass from "discourse/helpers/concat-class";import { SKIP } from "discourse/lib/autocomplete";import renderEmojiAutocomplete from "discourse/lib/autocomplete/emoji";import userAutocomplete from "discourse/lib/autocomplete/user";@@ -31,6 +40,11 @@ import {import virtualElementFromTextRange from "discourse/lib/virtual-element-from-text-range";import { waitForClosedKeyboard } from "discourse/lib/wait-for-keyboard";import { i18n } from "discourse-i18n";+import Button from "discourse/plugins/chat/discourse/components/chat/composer/button";+import ChatComposerDropdown from "discourse/plugins/chat/discourse/components/chat-composer-dropdown";+import ChatComposerMessageDetails from "discourse/plugins/chat/discourse/components/chat-composer-message-details";+import ChatComposerUploads from "discourse/plugins/chat/discourse/components/chat-composer-uploads";+import ChatReplyingIndicator from "discourse/plugins/chat/discourse/components/chat-replying-indicator";import { chatComposerButtons } from "discourse/plugins/chat/discourse/lib/chat-composer-buttons";import ChatMessageInteractor from "discourse/plugins/chat/discourse/lib/chat-message-interactor";import TextareaInteractor from "discourse/plugins/chat/discourse/lib/textarea-interactor";@@ -657,137 +671,144 @@ export default class ChatComposer extends Component {).delete();this.resetDraft();}-}-{{! template-lint-disable no-pointer-down-event-binding }}-{{! template-lint-disable no-invalid-interactive }}--<div class="chat-composer__wrapper">- {{#if this.shouldRenderMessageDetails}}- <ChatComposerMessageDetails- @message={{if this.draft.editing this.draft this.draft.inReplyTo}}- @cancelAction={{this.resetDraft}}- />- {{/if}}-- <div- role="region"- aria-label={{i18n "chat.aria_roles.composer"}}- class={{concat-class- "chat-composer"- (if this.isFocused "is-focused")- (if this.pane.sending "is-sending")- (if this.sendEnabled "is-send-enabled" "is-send-disabled")- (if this.disabled "is-disabled" "is-enabled")- (if this.draft.draftSaved "is-draft-saved" "is-draft-unsaved")- }}- {{did-update this.didUpdateMessage this.draft}}- {{did-update this.didUpdateInReplyTo this.draft.inReplyTo}}- {{did-insert this.setup}}- {{will-destroy this.teardown}}- {{will-destroy this.cancelPersistDraft}}- >- <div class="chat-composer__outer-container">- {{#if this.site.mobileView}}- <ChatComposerDropdown- @buttons={{this.dropdownButtons}}- @isDisabled={{this.disabled}}+ <template>+ {{! template-lint-disable no-pointer-down-event-binding }}+ {{! template-lint-disable no-invalid-interactive }}++ <div class="chat-composer__wrapper">+ {{#if this.shouldRenderMessageDetails}}+ <ChatComposerMessageDetails+ @message={{if this.draft.editing this.draft this.draft.inReplyTo}}+ @cancelAction={{this.resetDraft}}/>{{/if}}- <div class="chat-composer__inner-container">- {{#if this.site.desktopView}}- <ChatComposerDropdown- @buttons={{this.dropdownButtons}}- @isDisabled={{this.disabled}}- />- {{/if}}-- <div- class="chat-composer__input-container"- {{on "click" this.composer.focus}}- >- <DTextarea- id={{this.composerId}}- value={{readonly this.draft.message}}- type="text"- class="chat-composer__input"- disabled={{this.disabled}}- autocorrect="on"- autocapitalize="sentences"- placeholder={{this.placeholder}}- rows={{1}}- {{did-insert this.setupTextareaInteractor}}- {{on "input" this.onInput}}- {{on "keydown" this.onKeyDown}}- {{on "focusin" this.onTextareaFocusIn}}- {{on "focusout" this.onTextareaFocusOut}}- {{did-insert this.setupAutocomplete}}- data-chat-composer-context={{this.context}}- />- </div>+ <div+ role="region"+ aria-label={{i18n "chat.aria_roles.composer"}}+ class={{concatClass+ "chat-composer"+ (if this.isFocused "is-focused")+ (if this.pane.sending "is-sending")+ (if this.sendEnabled "is-send-enabled" "is-send-disabled")+ (if this.disabled "is-disabled" "is-enabled")+ (if this.draft.draftSaved "is-draft-saved" "is-draft-unsaved")+ }}+ {{didUpdate this.didUpdateMessage this.draft}}+ {{didUpdate this.didUpdateInReplyTo this.draft.inReplyTo}}+ {{didInsert this.setup}}+ {{willDestroy this.teardown}}+ {{willDestroy this.cancelPersistDraft}}+ >+ <div class="chat-composer__outer-container">+ {{#if this.site.mobileView}}+ <ChatComposerDropdown+ @buttons={{this.dropdownButtons}}+ @isDisabled={{this.disabled}}+ />+ {{/if}}++ <div class="chat-composer__inner-container">+ {{#if this.site.desktopView}}+ <ChatComposerDropdown+ @buttons={{this.dropdownButtons}}+ @isDisabled={{this.disabled}}+ />+ {{/if}}++ <div+ class="chat-composer__input-container"+ {{on "click" this.composer.focus}}+ >+ <DTextarea+ id={{this.composerId}}+ value={{readonly this.draft.message}}+ type="text"+ class="chat-composer__input"+ disabled={{this.disabled}}+ autocorrect="on"+ autocapitalize="sentences"+ placeholder={{this.placeholder}}+ rows={{1}}+ {{didInsert this.setupTextareaInteractor}}+ {{on "input" this.onInput}}+ {{on "keydown" this.onKeyDown}}+ {{on "focusin" this.onTextareaFocusIn}}+ {{on "focusout" this.onTextareaFocusOut}}+ {{didInsert this.setupAutocomplete}}+ data-chat-composer-context={{this.context}}+ />+ </div>++ {{#if this.inlineButtons.length}}+ {{#each this.inlineButtons as |button|}}+ <Button+ @icon={{button.icon}}+ class="-{{button.id}}"+ disabled={{or this.disabled button.disabled}}+ tabindex={{if button.disabled -1 0}}+ {{on+ "click"+ (fn this.handleInlineButtonAction button.action)+ }}+ {{on "focus" (fn this.computeIsFocused true)}}+ {{on "blur" (fn this.computeIsFocused false)}}+ />+ {{/each}}++ {{/if}}++ <PluginOutlet+ @name="chat-composer-inline-buttons"+ @outletArgs={{hash composer=this channel=@channel}}+ />- {{#if this.inlineButtons.length}}- {{#each this.inlineButtons as |button|}}- <Chat::Composer::Button- @icon={{button.icon}}- class="-{{button.id}}"- disabled={{or this.disabled button.disabled}}- tabindex={{if button.disabled -1 0}}- {{on "click" (fn this.handleInlineButtonAction button.action)}}+ {{#if this.site.desktopView}}+ <Button+ @icon="paper-plane"+ class="-send"+ title={{i18n "chat.composer.send"}}+ disabled={{or this.disabled (not this.sendEnabled)}}+ tabindex={{if this.sendEnabled 0 -1}}+ {{on "click" this.onSend}}+ {{on "mousedown" this.trapMouseDown}}+ {{on "focus" (fn this.computeIsFocused true)}}+ {{on "blur" (fn this.computeIsFocused false)}}+ />+ {{/if}}+ </div>+ {{#if this.site.mobileView}}+ <Button+ @icon="paper-plane"+ class="-send"+ title={{i18n "chat.composer.send"}}+ disabled={{or this.disabled (not this.sendEnabled)}}+ tabindex={{if this.sendEnabled 0 -1}}+ {{on "click" this.onSend}}+ {{on "mousedown" this.trapMouseDown}}{{on "focus" (fn this.computeIsFocused true)}}{{on "blur" (fn this.computeIsFocused false)}}/>- {{/each}}-- {{/if}}+ {{/if}}+ </div>+ </div>- <PluginOutlet- @name="chat-composer-inline-buttons"- @outletArgs={{hash composer=this channel=@channel}}+ {{#if this.canAttachUploads}}+ <ChatComposerUploads+ @fileUploadElementId={{this.fileUploadElementId}}+ @onUploadChanged={{this.onUploadChanged}}+ @existingUploads={{this.draft.uploads}}+ @uploadDropZone={{@uploadDropZone}}+ @composerInputEl={{this.composer.textarea.element}}/>+ {{/if}}- {{#if this.site.desktopView}}- <Chat::Composer::Button- @icon="paper-plane"- class="-send"- title={{i18n "chat.composer.send"}}- disabled={{or this.disabled (not this.sendEnabled)}}- tabindex={{if this.sendEnabled 0 -1}}- {{on "click" this.onSend}}- {{on "mousedown" this.trapMouseDown}}- {{on "focus" (fn this.computeIsFocused true)}}- {{on "blur" (fn this.computeIsFocused false)}}- />- {{/if}}- </div>- {{#if this.site.mobileView}}- <Chat::Composer::Button- @icon="paper-plane"- class="-send"- title={{i18n "chat.composer.send"}}- disabled={{or this.disabled (not this.sendEnabled)}}- tabindex={{if this.sendEnabled 0 -1}}- {{on "click" this.onSend}}- {{on "mousedown" this.trapMouseDown}}- {{on "focus" (fn this.computeIsFocused true)}}- {{on "blur" (fn this.computeIsFocused false)}}+ <div class="chat-replying-indicator-container">+ <ChatReplyingIndicator+ @presenceChannelName={{this.presenceChannelName}}/>- {{/if}}+ </div></div>- </div>-- {{#if this.canAttachUploads}}- <ChatComposerUploads- @fileUploadElementId={{this.fileUploadElementId}}- @onUploadChanged={{this.onUploadChanged}}- @existingUploads={{this.draft.uploads}}- @uploadDropZone={{@uploadDropZone}}- @composerInputEl={{this.composer.textarea.element}}- />- {{/if}}-- <div class="chat-replying-indicator-container">- <ChatReplyingIndicator @presenceChannelName={{this.presenceChannelName}} />- </div>-</div>\ No newline at end of file+ </template>+}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjsindex 2b6e33d72ab..5aa81521b12 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs@@ -1,14 +1,19 @@import Component from "@ember/component";+import { hash } from "@ember/helper";import { action } from "@ember/object";import { cancel, next, throttle } from "@ember/runloop";import { service } from "@ember/service";import { htmlSafe } from "@ember/template";import { tagName } from "@ember-decorators/component";import { observes } from "@ember-decorators/object";+import PluginOutlet from "discourse/components/plugin-outlet";+import bodyClass from "discourse/helpers/body-class";+import concatClass from "discourse/helpers/concat-class";import { bind } from "discourse/lib/decorators";import getURL from "discourse/lib/get-url";import DiscourseURL from "discourse/lib/url";import { escapeExpression } from "discourse/lib/utilities";+import chatResizableNode from "discourse/plugins/chat/discourse/modifiers/chat/resizable-node";@tagName("")export default class ChatDrawer extends Component {@@ -222,46 +227,50 @@ export default class ChatDrawer extends Component {didResize(element, { width, height }) {this.chatDrawerSize.size = { width, height };}-}-{{#if this.chatStateManager.isDrawerActive}}- {{bodyClass "chat-drawer-active"}}-{{/if}}--{{#if this.chatStateManager.isDrawerExpanded}}- {{bodyClass "chat-drawer-expanded"}}-{{/if}}--{{#if this.chatStateManager.isDrawerActive}}- <div- data-chat-channel-id={{this.chatDrawerRouter.model.channel.id}}- data-chat-thread-id={{this.chatDrawerRouter.model.channel.activeThread.id}}- class={{concat-class- "chat-drawer"- (if this.chatStateManager.isDrawerExpanded "is-expanded" "is-collapsed")- }}- {{chat/resizable-node ".chat-drawer-resizer" this.didResize}}- style={{this.drawerStyle}}- >- <div class="chat-drawer-container">- <div class="chat-drawer-resizer"></div>-- <PluginOutlet- @name="chat-drawer-before-content"- @outletArgs={{hash- currentRouteName=this.chatDrawerRouter.currentRouteName+ <template>+ {{#if this.chatStateManager.isDrawerActive}}+ {{bodyClass "chat-drawer-active"}}+ {{/if}}++ {{#if this.chatStateManager.isDrawerExpanded}}+ {{bodyClass "chat-drawer-expanded"}}+ {{/if}}++ {{#if this.chatStateManager.isDrawerActive}}+ <div+ data-chat-channel-id={{this.chatDrawerRouter.model.channel.id}}+ data-chat-thread-id={{this.chatDrawerRouter.model.channel.activeThread.id}}+ class={{concatClass+ "chat-drawer"+ (if+ this.chatStateManager.isDrawerExpanded "is-expanded" "is-collapsed"+ )}}- />-- <this.chatDrawerRouter.component- @params={{this.chatDrawerRouter.params}}- @model={{this.chatDrawerRouter.model}}- @openURL={{this.openURL}}- @openInFullPage={{this.openInFullPage}}- @toggleExpand={{this.toggleExpand}}- @close={{this.close}}- @drawerActions={{this.drawerActions}}- />- </div>- </div>-{{/if}}\ No newline at end of file+ {{chatResizableNode ".chat-drawer-resizer" this.didResize}}+ style={{this.drawerStyle}}+ >+ <div class="chat-drawer-container">+ <div class="chat-drawer-resizer"></div>++ <PluginOutlet+ @name="chat-drawer-before-content"+ @outletArgs={{hash+ currentRouteName=this.chatDrawerRouter.currentRouteName+ }}+ />++ <this.chatDrawerRouter.component+ @params={{this.chatDrawerRouter.params}}+ @model={{this.chatDrawerRouter.model}}+ @openURL={{this.openURL}}+ @openInFullPage={{this.openInFullPage}}+ @toggleExpand={{this.toggleExpand}}+ @close={{this.close}}+ @drawerActions={{this.drawerActions}}+ />+ </div>+ </div>+ {{/if}}+ </template>+}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-collapser.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-message-collapser.gjsindex 2d329e48f5e..5f7edc2793c 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-collapser.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-collapser.gjs@@ -2,9 +2,13 @@ import Component from "@glimmer/component";import { service } from "@ember/service";import { htmlSafe } from "@ember/template";import { modifier } from "ember-modifier";+import DecoratedHtml from "discourse/components/decorated-html";import domFromString from "discourse/lib/dom-from-string";import { escapeExpression } from "discourse/lib/utilities";import { i18n } from "discourse-i18n";+import ChatUpload from "discourse/plugins/chat/discourse/components/chat-upload";+import Collapser from "discourse/plugins/chat/discourse/components/collapser";+import LazyVideo from "discourse/plugins/discourse-lazy-videos/discourse/components/lazy-video";import lightbox from "../lib/lightbox";export default class ChatMessageCollapser extends Component {@@ -145,6 +149,56 @@ export default class ChatMessageCollapser extends Component {return acc;}, []);}++ <template>+ <div class="chat-message-collapser">+ {{#if this.hasUploads}}+ <DecoratedHtml+ @html={{htmlSafe @cooked}}+ @decorate={{@decorate}}+ @className="chat-cooked"+ />++ <Collapser+ @header={{this.uploadsHeader}}+ @onToggle={{@onToggleCollapse}}+ >+ <div class="chat-uploads" {{this.lightbox}}>+ {{#each @uploads as |upload|}}+ <ChatUpload @upload={{upload}} />+ {{/each}}+ </div>+ </Collapser>+ {{else}}+ {{#each this.cookedBodies as |cooked|}}+ {{#if cooked.needsCollapser}}+ <Collapser+ @header={{cooked.header}}+ @onToggle={{@onToggleCollapse}}+ >+ {{#if cooked.videoAttributes}}+ <div class="chat-message-collapser-lazy-video">+ <LazyVideo @videoAttributes={{cooked.videoAttributes}} />+ </div>+ {{else}}+ <DecoratedHtml+ @html={{htmlSafe cooked.body}}+ @decorate={{@decorate}}+ @className="chat-cooked"+ />+ {{/if}}+ </Collapser>+ {{else}}+ <DecoratedHtml+ @html={{htmlSafe cooked.body}}+ @decorate={{@decorate}}+ @className="chat-cooked"+ />+ {{/if}}+ {{/each}}+ {{/if}}+ </div>+ </template>}function lazyVideoPredicate(e) {@@ -223,45 +277,3 @@ export function isCollapsible(cooked, uploads) {hasGallery(elements));}--<div class="chat-message-collapser">- {{#if this.hasUploads}}- <DecoratedHtml- @html={{html-safe @cooked}}- @decorate={{@decorate}}- @className="chat-cooked"- />-- <Collapser @header={{this.uploadsHeader}} @onToggle={{@onToggleCollapse}}>- <div class="chat-uploads" {{this.lightbox}}>- {{#each @uploads as |upload|}}- <ChatUpload @upload={{upload}} />- {{/each}}- </div>- </Collapser>- {{else}}- {{#each this.cookedBodies as |cooked|}}- {{#if cooked.needsCollapser}}- <Collapser @header={{cooked.header}} @onToggle={{@onToggleCollapse}}>- {{#if cooked.videoAttributes}}- <div class="chat-message-collapser-lazy-video">- <LazyVideo @videoAttributes={{cooked.videoAttributes}} />- </div>- {{else}}- <DecoratedHtml- @html={{html-safe cooked.body}}- @decorate={{@decorate}}- @className="chat-cooked"- />- {{/if}}- </Collapser>- {{else}}- <DecoratedHtml- @html={{html-safe cooked.body}}- @decorate={{@decorate}}- @className="chat-cooked"- />- {{/if}}- {{/each}}- {{/if}}-</div>\ No newline at end of filediff --git a/plugins/chat/assets/javascripts/discourse/components/chat-to-topic-selector.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-to-topic-selector.gjsindex d38803e2a07..a6d3c78e6e6 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-to-topic-selector.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-to-topic-selector.gjs@@ -1,7 +1,15 @@import Component from "@ember/component";+import { fn } from "@ember/helper";import { alias, equal } from "@ember/object/computed";import { htmlSafe } from "@ember/template";+import { and } from "truth-helpers";+import ChooseTopic from "discourse/components/choose-topic";+import RadioButton from "discourse/components/radio-button";+import TextField from "discourse/components/text-field";import discourseComputed from "discourse/lib/decorators";+import { i18n } from "discourse-i18n";+import CategoryChooser from "select-kit/components/category-chooser";+import TagChooser from "select-kit/components/tag-chooser";export const NEW_TOPIC_SELECTION = "new_topic";export const EXISTING_TOPIC_SELECTION = "existing_topic";@@ -40,105 +48,107 @@ export default class ChatToTopicSelector extends Component {newMessageInstruction() {return htmlSafe(this.instructionLabels[NEW_MESSAGE_SELECTION]);}-}-<div class="chat-to-topic-selector">- <div class="radios">- <label class="radio-label" for="move-to-new-topic">- <RadioButton- @id="move-to-new-topic"- @name="move-to-entity"- @value={{this.newTopicSelection}}- @selection={{this.selection}}- />- <b>{{i18n "topic.split_topic.radio_label"}}</b>- </label>-- <label class="radio-label" for="move-to-existing-topic">- <RadioButton- @id="move-to-existing-topic"- @name="move-to-entity"- @value={{this.existingTopicSelection}}- @selection={{this.selection}}- />- <b>{{i18n "topic.merge_topic.radio_label"}}</b>- </label>-- {{#if this.allowNewMessage}}- <label class="radio-label" for="move-to-new-message">- <RadioButton- @id="move-to-new-message"- @name="move-to-entity"- @value={{this.newMessageSelection}}- @selection={{this.selection}}- />- <b>{{i18n "topic.move_to_new_message.radio_label"}}</b>- </label>- {{/if}}- </div>-- {{#if this.newTopic}}- <p>{{this.newTopicInstruction}}</p>-- <form>- <label for="split-topic-name">- {{i18n "topic.split_topic.topic_name"}}- </label>-- <TextField- @value={{this.topicTitle}}- @placeholderKey="composer.title_placeholder"- @id="split-topic-name"- />-- <label>{{i18n "categories.category"}}</label>-- <CategoryChooser- @id="new-topic-category-selector"- @value={{this.categoryId}}- @onChange={{fn (mut this.categoryId)}}- class="small"- />-- {{#if this.canAddTags}}- <label>{{i18n "tagging.tags"}}</label>- <TagChooser- @tags={{this.tags}}- @filterable={{true}}- @categoryId={{this.categoryId}}- />+ <template>+ <div class="chat-to-topic-selector">+ <div class="radios">+ <label class="radio-label" for="move-to-new-topic">+ <RadioButton+ @id="move-to-new-topic"+ @name="move-to-entity"+ @value={{this.newTopicSelection}}+ @selection={{this.selection}}+ />+ <b>{{i18n "topic.split_topic.radio_label"}}</b>+ </label>++ <label class="radio-label" for="move-to-existing-topic">+ <RadioButton+ @id="move-to-existing-topic"+ @name="move-to-entity"+ @value={{this.existingTopicSelection}}+ @selection={{this.selection}}+ />+ <b>{{i18n "topic.merge_topic.radio_label"}}</b>+ </label>++ {{#if this.allowNewMessage}}+ <label class="radio-label" for="move-to-new-message">+ <RadioButton+ @id="move-to-new-message"+ @name="move-to-entity"+ @value={{this.newMessageSelection}}+ @selection={{this.selection}}+ />+ <b>{{i18n "topic.move_to_new_message.radio_label"}}</b>+ </label>+ {{/if}}+ </div>++ {{#if this.newTopic}}+ <p>{{this.newTopicInstruction}}</p>++ <form>+ <label for="split-topic-name">+ {{i18n "topic.split_topic.topic_name"}}+ </label>++ <TextField+ @value={{this.topicTitle}}+ @placeholderKey="composer.title_placeholder"+ @id="split-topic-name"+ />++ <label>{{i18n "categories.category"}}</label>++ <CategoryChooser+ @id="new-topic-category-selector"+ @value={{this.categoryId}}+ @onChange={{fn (mut this.categoryId)}}+ class="small"+ />++ {{#if this.canAddTags}}+ <label>{{i18n "tagging.tags"}}</label>+ <TagChooser+ @tags={{this.tags}}+ @filterable={{true}}+ @categoryId={{this.categoryId}}+ />+ {{/if}}+ </form>{{/if}}- </form>- {{/if}}-- {{#if this.existingTopic}}- <p>{{this.existingTopicInstruction}}</p>- <form>- <ChooseTopic- @topicChangedCallback={{@topicChangedCallback}}- @selectedTopicId={{@selectedTopicId}}- />- </form>- {{/if}}-- {{#if (and this.allowNewMessage this.newMessage)}}- <p>{{this.newMessageInstruction}}</p>-- <form>- <label for="split-message-title">- {{i18n "topic.move_to_new_message.message_title"}}- </label>-- <TextField- @value={{this.topicTitle}}- @placeholderKey="composer.title_placeholder"- @id="split-message-title"- />-- {{#if this.canTagMessages}}- <label>{{i18n "tagging.tags"}}</label>- <TagChooser @tags={{this.tags}} @filterable={{true}} />++ {{#if this.existingTopic}}+ <p>{{this.existingTopicInstruction}}</p>+ <form>+ <ChooseTopic+ @topicChangedCallback={{@topicChangedCallback}}+ @selectedTopicId={{@selectedTopicId}}+ />+ </form>{{/if}}- </form>- {{/if}}-</div>\ No newline at end of file++ {{#if (and this.allowNewMessage this.newMessage)}}+ <p>{{this.newMessageInstruction}}</p>++ <form>+ <label for="split-message-title">+ {{i18n "topic.move_to_new_message.message_title"}}+ </label>++ <TextField+ @value={{this.topicTitle}}+ @placeholderKey="composer.title_placeholder"+ @id="split-message-title"+ />++ {{#if this.canTagMessages}}+ <label>{{i18n "tagging.tags"}}</label>+ <TagChooser @tags={{this.tags}} @filterable={{true}} />+ {{/if}}+ </form>+ {{/if}}+ </div>+ </template>+}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/create-channel.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/create-channel.gjsindex e0d87626876..04b741a00aa 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/create-channel.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/create-channel.gjs@@ -1,16 +1,25 @@import Component from "@glimmer/component";import { tracked } from "@glimmer/tracking";+import { Input } from "@ember/component";+import { hash } from "@ember/helper";+import { on } from "@ember/modifier";import { action } from "@ember/object";import { cancel } from "@ember/runloop";import { service } from "@ember/service";import { htmlSafe } from "@ember/template";import { isBlank, isPresent } from "@ember/utils";+import DModal from "discourse/components/d-modal";+import concatClass from "discourse/helpers/concat-class";+import icon from "discourse/helpers/d-icon";+import withEventValue from "discourse/helpers/with-event-value";import { ajax } from "discourse/lib/ajax";import { extractError } from "discourse/lib/ajax-error";import discourseDebounce from "discourse/lib/debounce";import { escapeExpression } from "discourse/lib/utilities";import Category from "discourse/models/category";import I18n, { i18n } from "discourse-i18n";+import CategoryChooser from "select-kit/components/category-chooser";+import DTooltip from "float-kit/components/d-tooltip";const DEFAULT_HINT = htmlSafe(i18n("chat.create_channel.choose_category.default_hint", {@@ -253,139 +262,141 @@ export default class ChatModalCreateChannel extends Component {300);}-}-<DModal- @closeModal={{@closeModal}}- class="chat-modal-create-channel"- @inline={{@inline}}- @title={{i18n "chat.create_channel.title"}}- @flash={{this.flash}}- @tagName="form"- {{on "submit" this.onSave}}->- <:body>- <div class="chat-modal-create-channel__control -name">- <label for="name" class="chat-modal-create-channel__label">- {{i18n "chat.create_channel.name"}}- </label>- <Input- name="name"- class="chat-modal-create-channel__input"- @type="text"- @value={{this.name}}- {{on "input" (with-event-value this.onNameChange)}}- />- </div>-- <div class="chat-modal-create-channel__control -slug">- <label for="slug" class="chat-modal-create-channel__label">- {{i18n "chat.create_channel.slug"}} - <span>- {{d-icon "circle-info"}}- <DTooltip>- {{i18n "chat.channel_edit_name_slug_modal.slug_description"}}- </DTooltip>- </span>- </label>- <Input- name="slug"- class="chat-modal-create-channel__input"- @type="text"- @value={{this.slug}}- placeholder={{this.autoGeneratedSlug}}- />- </div>-- <div class="chat-modal-create-channel__control -description">- <label for="description" class="chat-modal-create-channel__label">- {{i18n "chat.create_channel.description"}}- </label>- <Input- name="description"- class="chat-modal-create-channel__input"- @type="textarea"- @value={{this.description}}- />- </div>-- <div class="chat-modal-create-channel__control">- <label class="chat-modal-create-channel__label">- {{i18n "chat.create_channel.choose_category.label"}}- </label>- <CategoryChooser- @value={{this.categoryId}}- @onChange={{this.onCategoryChange}}- @options={{hash- formName="chatable_id"- none="chat.create_channel.choose_category.none"- }}- />-- {{#if this.categoryPermissionsHint}}- <div- class={{concat-class- "chat-modal-create-channel__hint"- (if this.loadingPermissionHint "loading-permissions")- }}- >- {{this.categoryPermissionsHint}}+ <template>+ <DModal+ @closeModal={{@closeModal}}+ class="chat-modal-create-channel"+ @inline={{@inline}}+ @title={{i18n "chat.create_channel.title"}}+ @flash={{this.flash}}+ @tagName="form"+ {{on "submit" this.onSave}}+ >+ <:body>+ <div class="chat-modal-create-channel__control -name">+ <label for="name" class="chat-modal-create-channel__label">+ {{i18n "chat.create_channel.name"}}+ </label>+ <Input+ name="name"+ class="chat-modal-create-channel__input"+ @type="text"+ @value={{this.name}}+ {{on "input" (withEventValue this.onNameChange)}}+ /></div>- {{/if}}- </div>- {{#if this.autoJoinAvailable}}- <div class="chat-modal-create-channel__control -auto-join">- <label class="chat-modal-create-channel__label">+ <div class="chat-modal-create-channel__control -slug">+ <label for="slug" class="chat-modal-create-channel__label">+ {{i18n "chat.create_channel.slug"}} + <span>+ {{icon "circle-info"}}+ <DTooltip>+ {{i18n "chat.channel_edit_name_slug_modal.slug_description"}}+ </DTooltip>+ </span>+ </label><Input- name="auto_join_users"- @type="checkbox"- @checked={{this.autoJoinUsers}}+ name="slug"+ class="chat-modal-create-channel__input"+ @type="text"+ @value={{this.slug}}+ placeholder={{this.autoGeneratedSlug}}/>- <div class="auto-join-channel">- <span class="chat-modal-create-channel__label-title">- {{i18n "chat.settings.auto_join_users_label"}}- </span>- <p class="chat-modal-create-channel__label-description">- {{#if this.categoryName}}- {{i18n- "chat.settings.auto_join_users_info"- category=this.categoryName- }}- {{else}}- {{i18n "chat.settings.auto_join_users_info_no_category"}}- {{/if}}- </p>+ </div>++ <div class="chat-modal-create-channel__control -description">+ <label for="description" class="chat-modal-create-channel__label">+ {{i18n "chat.create_channel.description"}}+ </label>+ <Input+ name="description"+ class="chat-modal-create-channel__input"+ @type="textarea"+ @value={{this.description}}+ />+ </div>++ <div class="chat-modal-create-channel__control">+ <label class="chat-modal-create-channel__label">+ {{i18n "chat.create_channel.choose_category.label"}}+ </label>+ <CategoryChooser+ @value={{this.categoryId}}+ @onChange={{this.onCategoryChange}}+ @options={{hash+ formName="chatable_id"+ none="chat.create_channel.choose_category.none"+ }}+ />++ {{#if this.categoryPermissionsHint}}+ <div+ class={{concatClass+ "chat-modal-create-channel__hint"+ (if this.loadingPermissionHint "loading-permissions")+ }}+ >+ {{this.categoryPermissionsHint}}+ </div>+ {{/if}}+ </div>++ {{#if this.autoJoinAvailable}}+ <div class="chat-modal-create-channel__control -auto-join">+ <label class="chat-modal-create-channel__label">+ <Input+ name="auto_join_users"+ @type="checkbox"+ @checked={{this.autoJoinUsers}}+ />+ <div class="auto-join-channel">+ <span class="chat-modal-create-channel__label-title">+ {{i18n "chat.settings.auto_join_users_label"}}+ </span>+ <p class="chat-modal-create-channel__label-description">+ {{#if this.categoryName}}+ {{i18n+ "chat.settings.auto_join_users_info"+ category=this.categoryName+ }}+ {{else}}+ {{i18n "chat.settings.auto_join_users_info_no_category"}}+ {{/if}}+ </p>+ </div>+ </label></div>- </label>- </div>- {{/if}}-- <div class="chat-modal-create-channel__control -threading-toggle">- <label class="chat-modal-create-channel__label">- <Input- name="threading_enabled"- @type="checkbox"- @checked={{this.threadingEnabled}}- />- <div class="threading-channel">- <span class="chat-modal-create-channel__label-title">- {{i18n "chat.create_channel.threading.label"}}- </span>- <p class="chat-modal-create-channel__label-description">- {{i18n "chat.settings.channel_threading_description"}}- </p>+ {{/if}}++ <div class="chat-modal-create-channel__control -threading-toggle">+ <label class="chat-modal-create-channel__label">+ <Input+ name="threading_enabled"+ @type="checkbox"+ @checked={{this.threadingEnabled}}+ />+ <div class="threading-channel">+ <span class="chat-modal-create-channel__label-title">+ {{i18n "chat.create_channel.threading.label"}}+ </span>+ <p class="chat-modal-create-channel__label-description">+ {{i18n "chat.settings.channel_threading_description"}}+ </p>+ </div>+ </label></div>- </label>- </div>- </:body>- <:footer>- <button- class="btn btn-primary create"- disabled={{this.createDisabled}}- type="submit"- >- {{i18n "chat.create_channel.create"}}- </button>- </:footer>-</DModal>\ No newline at end of file+ </:body>+ <:footer>+ <button+ class="btn btn-primary create"+ disabled={{this.createDisabled}}+ type="submit"+ >+ {{i18n "chat.create_channel.create"}}+ </button>+ </:footer>+ </DModal>+ </template>+}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/modal/edit-channel-description.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/modal/edit-channel-description.gjsindex 6944985290a..13c1130fdda 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat/modal/edit-channel-description.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat/modal/edit-channel-description.gjs@@ -1,8 +1,15 @@import Component from "@glimmer/component";import { tracked } from "@glimmer/tracking";+import { on } from "@ember/modifier";import { action } from "@ember/object";import { service } from "@ember/service";+import CharCounter from "discourse/components/char-counter";+import DButton from "discourse/components/d-button";+import DModal from "discourse/components/d-modal";+import DModalCancel from "discourse/components/d-modal-cancel";+import withEventValue from "discourse/helpers/with-event-value";import { extractError } from "discourse/lib/ajax-error";+import { i18n } from "discourse-i18n";const DESCRIPTION_MAX_LENGTH = 280;@@ -45,39 +52,41 @@ export default class ChatModalEditChannelDescription extends Component {this.flash = null;this.editedDescription = description;}-}-<DModal- @closeModal={{@closeModal}}- class="chat-modal-edit-channel-description"- @inline={{@inline}}- @title={{i18n "chat.channel_edit_description_modal.title"}}- @flash={{this.flash}}->- <:body>- <span class="chat-modal-edit-channel-description__description">{{i18n- "chat.channel_edit_description_modal.description"- }}</span>- <CharCounter- @value={{this.editedDescription}}- @max={{this.descriptionMaxLength}}+ <template>+ <DModal+ @closeModal={{@closeModal}}+ class="chat-modal-edit-channel-description"+ @inline={{@inline}}+ @title={{i18n "chat.channel_edit_description_modal.title"}}+ @flash={{this.flash}}>- <textarea- {{on "input" (with-event-value this.onChangeChatChannelDescription)}}- class="chat-modal-edit-channel-description__description-input"- placeholder={{i18n- "chat.channel_edit_description_modal.input_placeholder"- }}- >{{this.editedDescription}}</textarea>- </CharCounter>- </:body>- <:footer>- <DButton- @action={{this.onSaveChatChannelDescription}}- @label="save"- @disabled={{this.isSaveDisabled}}- class="btn-primary create"- />- <DModalCancel @close={{@closeModal}} />- </:footer>-</DModal>\ No newline at end of file+ <:body>+ <span class="chat-modal-edit-channel-description__description">{{i18n+ "chat.channel_edit_description_modal.description"+ }}</span>+ <CharCounter+ @value={{this.editedDescription}}+ @max={{this.descriptionMaxLength}}+ >+ <textarea+ {{on "input" (withEventValue this.onChangeChatChannelDescription)}}+ class="chat-modal-edit-channel-description__description-input"+ placeholder={{i18n+ "chat.channel_edit_description_modal.input_placeholder"+ }}+ >{{this.editedDescription}}</textarea>+ </CharCounter>+ </:body>+ <:footer>+ <DButton+ @action={{this.onSaveChatChannelDescription}}+ @label="save"+ @disabled={{this.isSaveDisabled}}+ class="btn-primary create"+ />+ <DModalCancel @close={{@closeModal}} />+ </:footer>+ </DModal>+ </template>+}diff --git a/plugins/chat/assets/javascripts/discourse/components/collapser.gjs b/plugins/chat/assets/javascripts/discourse/components/collapser.gjsindex e6773829fae..ca12c5ee3d5 100644--- a/plugins/chat/assets/javascripts/discourse/components/collapser.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/collapser.gjs@@ -1,6 +1,8 @@import Component from "@ember/component";import { action } from "@ember/object";import { tagName } from "@ember-decorators/component";+import DButton from "discourse/components/d-button";+import concatClass from "discourse/helpers/concat-class";@tagName("")export default class Collapser extends Component {@@ -19,31 +21,33 @@ export default class Collapser extends Component {this.set("collapsed", true);this.onToggle?.(true);}-}-<div class="chat-message-collapser-header">- {{this.header}}+ <template>+ <div class="chat-message-collapser-header">+ {{this.header}}- {{#if this.collapsed}}- <DButton- @action={{this.open}}- @icon="caret-right"- class="chat-message-collapser-button chat-message-collapser-closed"- />- {{else}}- <DButton- @action={{this.close}}- @icon="caret-down"- class="chat-message-collapser-button chat-message-collapser-opened"- />- {{/if}}-</div>+ {{#if this.collapsed}}+ <DButton+ @action={{this.open}}+ @icon="caret-right"+ class="chat-message-collapser-button chat-message-collapser-closed"+ />+ {{else}}+ <DButton+ @action={{this.close}}+ @icon="caret-down"+ class="chat-message-collapser-button chat-message-collapser-opened"+ />+ {{/if}}+ </div>-<div- class={{concat-class- "chat-message-collapser-body"- (if this.collapsed "hidden")- }}->- {{yield this.collapsed}}-</div>\ No newline at end of file+ <div+ class={{concatClass+ "chat-message-collapser-body"+ (if this.collapsed "hidden")+ }}+ >+ {{yield this.collapsed}}+ </div>+ </template>+}diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-browse-all.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-browse-all.gjsindex bd73ca0d68c..ebb68cd6b8f 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-browse-all.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-browse-all.gjs@@ -1 +1,6 @@-<BrowseChannels @currentTab="all" />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import BrowseChannels from "discourse/plugins/chat/discourse/components/browse-channels";++export default RouteTemplate(+ <template><BrowseChannels @currentTab="all" /></template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-browse-archived.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-browse-archived.gjsindex 0cc4d1ac2bf..0aa233ca11c 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-browse-archived.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-browse-archived.gjs@@ -1 +1,6 @@-<BrowseChannels @currentTab="archived" />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import BrowseChannels from "discourse/plugins/chat/discourse/components/browse-channels";++export default RouteTemplate(+ <template><BrowseChannels @currentTab="archived" /></template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-browse-closed.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-browse-closed.gjsindex 3dd4d6e9a30..082fe2af5db 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-browse-closed.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-browse-closed.gjs@@ -1 +1,6 @@-<BrowseChannels @currentTab="closed" />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import BrowseChannels from "discourse/plugins/chat/discourse/components/browse-channels";++export default RouteTemplate(+ <template><BrowseChannels @currentTab="closed" /></template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-browse-open.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-browse-open.gjsindex 6fc0bb370b9..012617f8fd6 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-browse-open.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-browse-open.gjs@@ -1 +1,6 @@-<BrowseChannels @currentTab="open" />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import BrowseChannels from "discourse/plugins/chat/discourse/components/browse-channels";++export default RouteTemplate(+ <template><BrowseChannels @currentTab="open" /></template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-browse.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-browse.gjsindex 7d44ab2ad4c..a4abe8e9edc 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-browse.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-browse.gjs@@ -1,13 +1,21 @@-<div class="c-routes --browse">- <Chat::Navbar as |navbar|>- <navbar.BackButton />- <navbar.Title @title={{i18n "chat.browse.title"}} />+import RouteTemplate from "ember-route-template";+import { i18n } from "discourse-i18n";+import Navbar from "discourse/plugins/chat/discourse/components/chat/navbar";- <navbar.Actions as |a|>- <a.NewChannelButton />- <a.OpenDrawerButton />- </navbar.Actions>- </Chat::Navbar>+export default RouteTemplate(+ <template>+ <div class="c-routes --browse">+ <Navbar as |navbar|>+ <navbar.BackButton />+ <navbar.Title @title={{i18n "chat.browse.title"}} />- {{outlet}}-</div>\ No newline at end of file+ <navbar.Actions as |a|>+ <a.NewChannelButton />+ <a.OpenDrawerButton />+ </navbar.Actions>+ </Navbar>++ {{outlet}}+ </div>+ </template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-members.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-members.gjsindex a4202f9b578..79fba5b8cd4 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-members.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-members.gjs@@ -1 +1,6 @@-<Chat::Routes::ChannelInfoMembers @channel={{this.model}} />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import ChannelInfoMembers from "discourse/plugins/chat/discourse/components/chat/routes/channel-info-members";++export default RouteTemplate(+ <template><ChannelInfoMembers @channel={{@controller.model}} /></template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-settings.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-settings.gjsindex 67e210956dd..a7abccd5f81 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-settings.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-settings.gjs@@ -1 +1,6 @@-<Chat::Routes::ChannelInfoSettings @channel={{this.model}} />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import ChannelInfoSettings from "discourse/plugins/chat/discourse/components/chat/routes/channel-info-settings";++export default RouteTemplate(+ <template><ChannelInfoSettings @channel={{@controller.model}} /></template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info.gjsindex 0b5fe6b6505..396b105d964 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info.gjs@@ -1 +1,6 @@-<Chat::Routes::ChannelInfo @channel={{this.model}} />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import ChannelInfo from "discourse/plugins/chat/discourse/components/chat/routes/channel-info";++export default RouteTemplate(+ <template><ChannelInfo @channel={{@controller.model}} /></template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-thread.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-thread.gjsindex 21f8d411a64..88fe672eed5 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-thread.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-thread.gjs@@ -1,4 +1,11 @@-<Chat::Routes::ChannelThread- @thread={{this.model}}- @targetMessageId={{this.targetMessageId}}-/>\ No newline at end of file+import RouteTemplate from "ember-route-template";+import ChannelThread from "discourse/plugins/chat/discourse/components/chat/routes/channel-thread";++export default RouteTemplate(+ <template>+ <ChannelThread+ @thread={{@controller.model}}+ @targetMessageId={{@controller.targetMessageId}}+ />+ </template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-threads.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-threads.gjsindex 372db102ec8..9c64713c80b 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-threads.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-threads.gjs@@ -1 +1,6 @@-<Chat::Routes::ChannelThreads @channel={{this.model}} />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import ChannelThreads from "discourse/plugins/chat/discourse/components/chat/routes/channel-threads";++export default RouteTemplate(+ <template><ChannelThreads @channel={{@controller.model}} /></template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channel.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-channel.gjsindex 0dba535ac07..e3a40212d55 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-channel.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channel.gjs@@ -1,4 +1,11 @@-<Chat::Routes::Channel- @channel={{this.model}}- @targetMessageId={{this.targetMessageId}}-/>\ No newline at end of file+import RouteTemplate from "ember-route-template";+import Channel from "discourse/plugins/chat/discourse/components/chat/routes/channel";++export default RouteTemplate(+ <template>+ <Channel+ @channel={{@controller.model}}+ @targetMessageId={{@controller.targetMessageId}}+ />+ </template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channels.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-channels.gjsindex d5000b5e4dc..9f35d39f0ad 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-channels.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channels.gjs@@ -1 +1,4 @@-<Chat::Routes::Channels />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import Channels from "discourse/plugins/chat/discourse/components/chat/routes/channels";++export default RouteTemplate(<template><Channels /></template>);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-direct-messages.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-direct-messages.gjsindex 9505cfbfede..58875be92fb 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-direct-messages.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-direct-messages.gjs@@ -1 +1,4 @@-<Chat::Routes::DirectMessages />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import DirectMessages from "discourse/plugins/chat/discourse/components/chat/routes/direct-messages";++export default RouteTemplate(<template><DirectMessages /></template>);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-index.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-index.gjsindex ec6c915d310..4dee3caff65 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-index.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-index.gjs@@ -1 +1,4 @@-<ChannelsList />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import ChannelsList from "discourse/plugins/chat/discourse/components/channels-list";++export default RouteTemplate(<template><ChannelsList /></template>);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-threads.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat-threads.gjsindex 21dabb3cab0..251e1be51ec 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-threads.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-threads.gjs@@ -1 +1,4 @@-<Chat::Routes::Threads />\ No newline at end of file+import RouteTemplate from "ember-route-template";+import Threads from "discourse/plugins/chat/discourse/components/chat/routes/threads";++export default RouteTemplate(<template><Threads /></template>);diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat.gjs b/plugins/chat/assets/javascripts/discourse/templates/chat.gjsindex 40cd71798cc..541b2c77f24 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat.gjs@@ -1,22 +1,34 @@-<div id="chat-progress-bar-container"></div>+import RouteTemplate from "ember-route-template";+import concatClass from "discourse/helpers/concat-class";+import ChannelsList from "discourse/plugins/chat/discourse/components/channels-list";+import ChatFooter from "discourse/plugins/chat/discourse/components/chat-footer";-<div- class={{concat-class- "full-page-chat"- (if this.shouldUseCoreSidebar "full-page-chat-sidebar-enabled")- }}->- {{#if this.shouldUseChatSidebar}}- <ChannelsList />- {{/if}}+export default RouteTemplate(+ <template>+ <div id="chat-progress-bar-container"></div>- <div- id="main-chat-outlet"- class={{concat-class "main-chat-outlet" this.mainOutletModifierClasses}}- >- {{outlet}}- {{#if this.shouldUseChatFooter}}- <ChatFooter />- {{/if}}- </div>-</div>\ No newline at end of file+ <div+ class={{concatClass+ "full-page-chat"+ (if @controller.shouldUseCoreSidebar "full-page-chat-sidebar-enabled")+ }}+ >+ {{#if @controller.shouldUseChatSidebar}}+ <ChannelsList />+ {{/if}}++ <div+ id="main-chat-outlet"+ class={{concatClass+ "main-chat-outlet"+ @controller.mainOutletModifierClasses+ }}+ >+ {{outlet}}+ {{#if @controller.shouldUseChatFooter}}+ <ChatFooter />+ {{/if}}+ </div>+ </div>+ </template>+);diff --git a/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.gjs b/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.gjsindex b8d2f7b406b..bfdca1fbb2d 100644--- a/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.gjs+++ b/plugins/chat/assets/javascripts/discourse/templates/preferences/chat.gjs@@ -1,158 +1,181 @@-<label class="control-label">{{i18n "chat.title_capitalized"}}</label>+import { Input } from "@ember/component";+import { concat, fn, hash } from "@ember/helper";+import { on } from "@ember/modifier";+import RouteTemplate from "ember-route-template";+import { eq } from "truth-helpers";+import SaveControls from "discourse/components/save-controls";+import withEventValue from "discourse/helpers/with-event-value";+import { i18n } from "discourse-i18n";+import ComboBox from "select-kit/components/combo-box";-<div class="control-group chat-setting" data-setting-name="user_chat_enabled">- <label class="controls">- <Input- id="user_chat_enabled"- @type="checkbox"- @checked={{this.model.user_option.chat_enabled}}- />- {{i18n "chat.enable"}}- </label>-</div>+export default RouteTemplate(+ <template>+ <label class="control-label">{{i18n "chat.title_capitalized"}}</label>-<div- class="control-group chat-setting"- data-setting-name="user_chat_only_push_notifications"->- <label class="controls">- <Input- id="user_chat_only_push_notifications"- @type="checkbox"- @checked={{this.model.user_option.only_chat_push_notifications}}- />- {{i18n "chat.only_chat_push_notifications.title"}}- </label>- <span class="control-instructions">- {{i18n "chat.only_chat_push_notifications.description"}}- </span>-</div>+ <div+ class="control-group chat-setting"+ data-setting-name="user_chat_enabled"+ >+ <label class="controls">+ <Input+ id="user_chat_enabled"+ @type="checkbox"+ @checked={{@controller.model.user_option.chat_enabled}}+ />+ {{i18n "chat.enable"}}+ </label>+ </div>-<div- class="control-group chat-setting"- data-setting-name="user_chat_ignore_channel_wide_mention"->- <label class="controls">- <Input- id="user_chat_ignore_channel_wide_mention"- @type="checkbox"- @checked={{this.model.user_option.ignore_channel_wide_mention}}- />- {{i18n "chat.ignore_channel_wide_mention.title"}}- </label>- <span class="control-instructions">- {{i18n "chat.ignore_channel_wide_mention.description"}}- </span>-</div>+ <div+ class="control-group chat-setting"+ data-setting-name="user_chat_only_push_notifications"+ >+ <label class="controls">+ <Input+ id="user_chat_only_push_notifications"+ @type="checkbox"+ @checked={{@controller.model.user_option.only_chat_push_notifications}}+ />+ {{i18n "chat.only_chat_push_notifications.title"}}+ </label>+ <span class="control-instructions">+ {{i18n "chat.only_chat_push_notifications.description"}}+ </span>+ </div>++ <div+ class="control-group chat-setting"+ data-setting-name="user_chat_ignore_channel_wide_mention"+ >+ <label class="controls">+ <Input+ id="user_chat_ignore_channel_wide_mention"+ @type="checkbox"+ @checked={{@controller.model.user_option.ignore_channel_wide_mention}}+ />+ {{i18n "chat.ignore_channel_wide_mention.title"}}+ </label>+ <span class="control-instructions">+ {{i18n "chat.ignore_channel_wide_mention.description"}}+ </span>+ </div>-<div- class="control-group chat-setting controls-dropdown"- data-setting-name="user_chat_sounds"->- <label for="user_chat_sounds">{{i18n "chat.sound.title"}}</label>- <ComboBox- @options={{hash none="chat.sounds.none"}}- @valueProperty="value"- @content={{this.chatSounds}}- @value={{this.model.user_option.chat_sound}}- @id="user_chat_sounds"- @onChange={{action "onChangeChatSound"}}- />-</div>+ <div+ class="control-group chat-setting controls-dropdown"+ data-setting-name="user_chat_sounds"+ >+ <label for="user_chat_sounds">{{i18n "chat.sound.title"}}</label>+ <ComboBox+ @options={{hash none="chat.sounds.none"}}+ @valueProperty="value"+ @content={{@controller.chatSounds}}+ @value={{@controller.model.user_option.chat_sound}}+ @id="user_chat_sounds"+ @onChange={{@controller.onChangeChatSound}}+ />+ </div>-<div- class="control-group chat-setting controls-dropdown"- data-setting-name="user_chat_email_frequency"->- <label for="user_chat_email_frequency">- {{i18n "chat.email_frequency.title"}}- </label>- <ComboBox- @valueProperty="value"- @content={{this.emailFrequencyOptions}}- @value={{this.model.user_option.chat_email_frequency}}- @id="user_chat_email_frequency"- @onChange={{fn (mut this.model.user_option.chat_email_frequency)}}- />- {{#if (eq this.model.user_option.chat_email_frequency "when_away")}}- <div class="control-instructions">- {{i18n "chat.email_frequency.description"}}+ <div+ class="control-group chat-setting controls-dropdown"+ data-setting-name="user_chat_email_frequency"+ >+ <label for="user_chat_email_frequency">+ {{i18n "chat.email_frequency.title"}}+ </label>+ <ComboBox+ @valueProperty="value"+ @content={{@controller.emailFrequencyOptions}}+ @value={{@controller.model.user_option.chat_email_frequency}}+ @id="user_chat_email_frequency"+ @onChange={{fn+ (mut @controller.model.user_option.chat_email_frequency)+ }}+ />+ {{#if+ (eq @controller.model.user_option.chat_email_frequency "when_away")+ }}+ <div class="control-instructions">+ {{i18n "chat.email_frequency.description"}}+ </div>+ {{/if}}</div>- {{/if}}-</div>-<div- class="control-group chat-setting controls-dropdown"- data-setting-name="user_chat_header_indicator_preference"->- <label for="user_chat_header_indicator_preference">- {{i18n "chat.header_indicator_preference.title"}}- </label>- <ComboBox- @valueProperty="value"- @content={{this.headerIndicatorOptions}}- @value={{this.model.user_option.chat_header_indicator_preference}}- @id="user_chat_header_indicator_preference"- @onChange={{fn- (mut this.model.user_option.chat_header_indicator_preference)- }}- />-</div>+ <div+ class="control-group chat-setting controls-dropdown"+ data-setting-name="user_chat_header_indicator_preference"+ >+ <label for="user_chat_header_indicator_preference">+ {{i18n "chat.header_indicator_preference.title"}}+ </label>+ <ComboBox+ @valueProperty="value"+ @content={{@controller.headerIndicatorOptions}}+ @value={{@controller.model.user_option.chat_header_indicator_preference}}+ @id="user_chat_header_indicator_preference"+ @onChange={{fn+ (mut @controller.model.user_option.chat_header_indicator_preference)+ }}+ />+ </div>-<div- class="control-group chat-setting controls-dropdown"- data-setting-name="user_chat_separate_sidebar_mode"->- <label for="user_chat_separate_sidebar_mode">- {{i18n "chat.separate_sidebar_mode.title"}}- </label>+ <div+ class="control-group chat-setting controls-dropdown"+ data-setting-name="user_chat_separate_sidebar_mode"+ >+ <label for="user_chat_separate_sidebar_mode">+ {{i18n "chat.separate_sidebar_mode.title"}}+ </label>- <ComboBox- @valueProperty="value"- @content={{this.chatSeparateSidebarModeOptions}}- @value={{this.chatSeparateSidebarMode}}- @id="user_chat_separate_sidebar_mode"- @onChange={{fn (mut this.model.user_option.chat_separate_sidebar_mode)}}- />-</div>+ <ComboBox+ @valueProperty="value"+ @content={{@controller.chatSeparateSidebarModeOptions}}+ @value={{@controller.chatSeparateSidebarMode}}+ @id="user_chat_separate_sidebar_mode"+ @onChange={{fn+ (mut @controller.model.user_option.chat_separate_sidebar_mode)+ }}+ />+ </div>-<div- class="control-group chat-setting controls-dropdown"- data-setting-name="user_chat_send_shortcut"->- <div class="radio-group">- {{#each this.chatSendShortcutOptions as |option|}}- <div class="radio-group-option">- <label class="controls">- <input- type="radio"- name="chat_send_shortcut"- id={{concat "chat_send_shortcut_" option.value}}- value={{option.value}}- checked={{eq- this.model.user_option.chat_send_shortcut- option.value- }}- {{on- "change"- (withEventValue- (fn (mut this.model.user_option.chat_send_shortcut))- )- }}- />- {{option.label}}- </label>- <span class="control-instructions">- {{option.description}}- </span>+ <div+ class="control-group chat-setting controls-dropdown"+ data-setting-name="user_chat_send_shortcut"+ >+ <div class="radio-group">+ {{#each @controller.chatSendShortcutOptions as |option|}}+ <div class="radio-group-option">+ <label class="controls">+ <input+ type="radio"+ name="chat_send_shortcut"+ id={{concat "chat_send_shortcut_" option.value}}+ value={{option.value}}+ checked={{eq+ @controller.model.user_option.chat_send_shortcut+ option.value+ }}+ {{on+ "change"+ (withEventValue+ (fn (mut @controller.model.user_option.chat_send_shortcut))+ )+ }}+ />+ {{option.label}}+ </label>+ <span class="control-instructions">+ {{option.description}}+ </span>+ </div>+ {{/each}}</div>- {{/each}}- </div>-</div>+ </div>-<SaveControls- @id="user_chat_preference_save"- @model={{this.model}}- @action={{action "save"}}- @saved={{this.saved}}-/>\ No newline at end of file+ <SaveControls+ @id="user_chat_preference_save"+ @model={{@controller.model}}+ @action={{@controller.save}}+ @saved={{@controller.saved}}+ />+ </template>+);diff --git a/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-card-test.gjsindex 397bf451afa..3134c7fc973 100644--- a/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-card-test.gjs@@ -1,9 +1,9 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";+import ChatChannelCard from "discourse/plugins/chat/discourse/components/chat-channel-card";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module("Discourse Chat | Component | chat-channel-card", function (hooks) {@@ -16,58 +16,90 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {});test("escapes channel title", async function (assert) {+ const self = this;+this.channel.title = "<div class='xss'>evil</div>";- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".xss").doesNotExist();});test("escapes channel description", async function (assert) {+ const self = this;+this.channel.description = "<div class='xss'>evil</div>";- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".xss").doesNotExist();});test("Closed channel", async function (assert) {+ const self = this;+this.channel.status = "closed";- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-card.--closed").exists();});test("Archived channel", async function (assert) {+ const self = this;+this.channel.status = "archived";- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-card.--archived").exists();});test("Muted channel", async function (assert) {+ const self = this;+this.channel.currentUserMembership.muted = true;this.channel.currentUserMembership.following = true;- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-card__muted").exists();});test("Joined channel", async function (assert) {+ const self = this;+this.channel.currentUserMembership.following = true;- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".toggle-channel-membership-button.-leave").exists();});test("Joinable channel", async function (assert) {- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-card__join-btn").exists();});test("Memberships count", async function (assert) {+ const self = this;+this.channel.membershipsCount = 4;- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-card__members")@@ -75,14 +107,22 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {});test("No description", async function (assert) {+ const self = this;+this.channel.description = null;- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-card__description").doesNotExist();});test("Description", async function (assert) {- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-card__description")@@ -90,14 +130,22 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {});test("Name", async function (assert) {- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-card__name").hasText(this.channel.title);});test("Read restricted chatable", async function (assert) {+ const self = this;+this.channel.chatable.read_restricted = true;- await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelCard @channel={{self.channel}} /></template>+ );assert.dom(".d-icon-lock").exists();});});diff --git a/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjsindex 9b16706df27..ad38ec24703 100644--- a/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-leave-btn-test.gjs@@ -1,22 +1,29 @@import { getOwner } from "@ember/owner";import { click, render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import pretender from "discourse/tests/helpers/create-pretender";import { i18n } from "discourse-i18n";+import ChatChannelLeaveBtn from "discourse/plugins/chat/discourse/components/chat-channel-leave-btn";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {setupRenderingTest(hooks);test("accepts an optional onLeaveChannel callback", async function (assert) {+ const self = this;+this.foo = 1;this.onLeaveChannel = () => (this.foo = 2);this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();await render(- hbs`<ChatChannelLeaveBtn @channel={{this.channel}} @onLeaveChannel={{this.onLeaveChannel}} />`+ <template>+ <ChatChannelLeaveBtn+ @channel={{self.channel}}+ @onLeaveChannel={{self.onLeaveChannel}}+ />+ </template>);pretender.post("/chat/chat_channels/:chatChannelId/unfollow", () => {@@ -29,9 +36,13 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {});test("has a specific title for direct message channel", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();- await render(hbs`<ChatChannelLeaveBtn @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelLeaveBtn @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-leave-btn")@@ -39,9 +50,13 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {});test("has a specific title for message channel", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel();- await render(hbs`<ChatChannelLeaveBtn @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelLeaveBtn @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-leave-btn")@@ -49,10 +64,14 @@ module("Discourse Chat | Component | chat-channel-leave-btn", function (hooks) {});test("is not visible on mobile", async function (assert) {+ const self = this;+this.site.desktopView = false;this.channel = new ChatFabricators(getOwner(this)).channel();- await render(hbs`<ChatChannelLeaveBtn @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelLeaveBtn @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-leave-btn").doesNotExist();});diff --git a/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjsindex 063ce399806..01312aae5cf 100644--- a/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-metadata-test.gjs@@ -1,14 +1,16 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatChannelMetadata from "discourse/plugins/chat/discourse/components/chat-channel-metadata";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module("Discourse Chat | Component | chat-channel-metadata", function (hooks) {setupRenderingTest(hooks);test("displays last message created at", async function (assert) {+ const self = this;+let lastMessageSentAt = moment().subtract(1, "day").format();this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();this.channel.lastMessage = new ChatFabricators(getOwner(this)).message({@@ -16,13 +18,17 @@ module("Discourse Chat | Component | chat-channel-metadata", function (hooks) {created_at: lastMessageSentAt,});- await render(hbs`<ChatChannelMetadata @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelMetadata @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel__metadata-date").hasText("Yesterday");lastMessageSentAt = moment();this.channel.lastMessage.createdAt = lastMessageSentAt;- await render(hbs`<ChatChannelMetadata @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelMetadata @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel__metadata-date")diff --git a/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjsindex 6b57a99441a..fb6b58e6598 100644--- a/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-preview-card-test.gjs@@ -1,8 +1,8 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatChannelPreviewCard from "discourse/plugins/chat/discourse/components/chat-channel-preview-card";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module(@@ -26,7 +26,13 @@ module(});test("channel title", async function (assert) {- await render(hbs`<ChatChannelPreviewCard @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelPreviewCard @channel={{self.channel}} />+ </template>+ );assert.dom(".chat-channel-name__label")@@ -38,7 +44,13 @@ module(});test("channel description", async function (assert) {- await render(hbs`<ChatChannelPreviewCard @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelPreviewCard @channel={{self.channel}} />+ </template>+ );assert.dom(".chat-channel-preview-card__description")@@ -46,9 +58,15 @@ module(});test("no channel description", async function (assert) {+ const self = this;+this.channel.description = null;- await render(hbs`<ChatChannelPreviewCard @channel={{this.channel}} />`);+ await render(+ <template>+ <ChatChannelPreviewCard @channel={{self.channel}} />+ </template>+ );assert.dom(".chat-channel-preview-card__description")@@ -62,7 +80,13 @@ module(});test("join", async function (assert) {- await render(hbs`<ChatChannelPreviewCard @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelPreviewCard @channel={{self.channel}} />+ </template>+ );assert.dom(".toggle-channel-membership-button.-join")@@ -70,7 +94,13 @@ module(});test("browse all", async function (assert) {- await render(hbs`<ChatChannelPreviewCard @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelPreviewCard @channel={{self.channel}} />+ </template>+ );assert.dom(".chat-channel-preview-card__browse-all")@@ -78,8 +108,14 @@ module(});test("closed channel", async function (assert) {+ const self = this;+this.channel.status = "closed";- await render(hbs`<ChatChannelPreviewCard @channel={{this.channel}} />`);+ await render(+ <template>+ <ChatChannelPreviewCard @channel={{self.channel}} />+ </template>+ );assert.dom(".chat-channel-preview-card__join-channel-btn")diff --git a/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-row-test.gjsindex d1d659c4221..9dc07ef2b13 100644--- a/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-row-test.gjs@@ -1,9 +1,10 @@+import { hash } from "@ember/helper";import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import CoreFabricators from "discourse/lib/fabricators";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatChannelRow from "discourse/plugins/chat/discourse/components/chat-channel-row";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module("Discourse Chat | Component | chat-channel-row", function (hooks) {@@ -17,7 +18,13 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {});test("links to correct channel", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row")@@ -28,13 +35,25 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {});test("allows tabbing", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").hasAttribute("tabindex", "0");});test("channel id data attribute", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row")@@ -45,7 +64,13 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {});test("renders correct channel title", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-name__label")@@ -53,12 +78,18 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {});test("renders correct channel metadata", async function (assert) {+ const self = this;+this.categoryChatChannel.lastMessage = new ChatFabricators(getOwner(this)).message({created_at: moment().toISOString(),});- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel__metadata-date")@@ -68,65 +99,117 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {});test("renders membership toggling button when necessary", async function (assert) {+ const self = this;+this.site.desktopView = false;- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}}/>`);+ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".toggle-channel-membership-button").doesNotExist();this.categoryChatChannel.currentUserMembership.following = true;- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".toggle-channel-membership-button").doesNotExist();this.site.desktopView = true;await render(- hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} @options={{hash leaveButton=true}}/>`+ <template>+ <ChatChannelRow+ @channel={{self.categoryChatChannel}}+ @options={{hash leaveButton=true}}+ />+ </template>);assert.dom(".toggle-channel-membership-button").exists();});test("focused channel has correct class", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").doesNotHaveClass("focused");this.categoryChatChannel.focused = true;- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").hasClass("focused");});test("muted channel has correct class", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").doesNotHaveClass("muted");this.categoryChatChannel.currentUserMembership.muted = true;- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").hasClass("muted");});test("leaveButton options adds correct class", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").doesNotHaveClass("can-leave");await render(- hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} @options={{hash leaveButton=true}} />`+ <template>+ <ChatChannelRow+ @channel={{self.categoryChatChannel}}+ @options={{hash leaveButton=true}}+ />+ </template>);assert.dom(".chat-channel-row").hasClass("can-leave");});test("active channel adds correct class", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").doesNotHaveClass("active");@@ -134,30 +217,52 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {.lookup("service:chat").set("activeChannel", { id: this.categoryChatChannel.id });- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").hasClass("active");});test("unreads adds correct class", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").doesNotHaveClass("has-unread");this.categoryChatChannel.tracking.unreadCount = 1;- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".chat-channel-row").hasClass("has-unread");});test("user status with category channel", async function (assert) {- await render(hbs`<ChatChannelRow @channel={{this.categoryChatChannel}} />`);+ const self = this;++ await render(+ <template>+ <ChatChannelRow @channel={{self.categoryChatChannel}} />+ </template>+ );assert.dom(".user-status-message").doesNotExist();});test("user status with direct message channel", async function (assert) {+ const self = this;+this.directMessageChannel.chatable = new ChatFabricators(getOwner(this)).directMessage({@@ -167,13 +272,17 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {this.directMessageChannel.chatable.users[0].status = status;await render(- hbs`<ChatChannelRow @channel={{this.directMessageChannel}} />`+ <template>+ <ChatChannelRow @channel={{self.directMessageChannel}} />+ </template>);assert.dom(".user-status-message").exists();});test("user status with direct message channel and multiple users", async function (assert) {+ const self = this;+const status = { description: "Off to dentist", emoji: "tooth" };this.directMessageChannel.chatable.users[0].status = status;@@ -185,7 +294,9 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {});await render(- hbs`<ChatChannelRow @channel={{this.directMessageChannel}} />`+ <template>+ <ChatChannelRow @channel={{self.directMessageChannel}} />+ </template>);assert.dom(".user-status-message").doesNotExist();diff --git a/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-status-test.gjsindex 8ae54384a97..256801d61db 100644--- a/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-status-test.gjs@@ -1,9 +1,9 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";+import ChatChannelStatus from "discourse/plugins/chat/discourse/components/chat-channel-status";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";import {CHANNEL_STATUSES,@@ -14,19 +14,27 @@ module("Discourse Chat | Component | chat-channel-status", function (hooks) {setupRenderingTest(hooks);test("renders nothing when channel is opened", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel();- await render(hbs`<ChatChannelStatus @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelStatus @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-status").doesNotExist();});test("defaults to long format", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel({status: CHANNEL_STATUSES.closed,});- await render(hbs`<ChatChannelStatus @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelStatus @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-status")@@ -34,12 +42,16 @@ module("Discourse Chat | Component | chat-channel-status", function (hooks) {});test("accepts a format argument", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel({status: CHANNEL_STATUSES.archived,});await render(- hbs`<ChatChannelStatus @channel={{this.channel}} @format="short" />`+ <template>+ <ChatChannelStatus @channel={{self.channel}} @format="short" />+ </template>);assert@@ -48,23 +60,31 @@ module("Discourse Chat | Component | chat-channel-status", function (hooks) {});test("renders the correct icon", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel({status: CHANNEL_STATUSES.archived,});- await render(hbs`<ChatChannelStatus @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelStatus @channel={{self.channel}} /></template>+ );assert.dom(`.d-icon-${channelStatusIcon(this.channel.status)}`).exists();});test("renders archive status", async function (assert) {+ const self = this;+this.currentUser.admin = true;this.channel = new ChatFabricators(getOwner(this)).channel({status: CHANNEL_STATUSES.archived,archive_failed: true,});- await render(hbs`<ChatChannelStatus @channel={{this.channel}} />`);+ await render(+ <template><ChatChannelStatus @channel={{self.channel}} /></template>+ );assert.dom(".chat-channel-retry-archive").exists();});diff --git a/plugins/chat/test/javascripts/components/chat-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-channel-test.gjsindex ed4d054ad37..8fdd45b7c80 100644--- a/plugins/chat/test/javascripts/components/chat-channel-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-channel-test.gjs@@ -1,10 +1,11 @@import { getOwner } from "@ember/owner";import { render, triggerEvent, waitFor } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import pretender, { response } from "discourse/tests/helpers/create-pretender";import { publishToMessageBus } from "discourse/tests/helpers/qunit-helpers";+import DTooltips from "float-kit/components/d-tooltips";+import ChatChannel from "discourse/plugins/chat/discourse/components/chat-channel";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module(@@ -68,7 +69,11 @@ module(});test("it shows status on mentions", async function (assert) {- await render(hbs`<ChatChannel @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template><ChatChannel @channel={{self.channel}} /></template>+ );assertStatusIsRendered(assert,@@ -78,7 +83,11 @@ module(});test("it updates status on mentions", async function (assert) {- await render(hbs`<ChatChannel @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template><ChatChannel @channel={{self.channel}} /></template>+ );const newStatus = {description: "off to dentist",@@ -100,7 +109,11 @@ module(});test("it deletes status on mentions", async function (assert) {- await render(hbs`<ChatChannel @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template><ChatChannel @channel={{self.channel}} /></template>+ );this.appEvents.trigger("user-status:changed", {[mentionedUser.id]: null,@@ -112,7 +125,11 @@ module(});test("it shows status on mentions on messages that came from Message Bus", async function (assert) {- await render(hbs`<ChatChannel @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template><ChatChannel @channel={{self.channel}} /></template>+ );await receiveChatMessageViaMessageBus();@@ -124,7 +141,11 @@ module(});test("it updates status on mentions on messages that came from Message Bus", async function (assert) {- await render(hbs`<ChatChannel @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template><ChatChannel @channel={{self.channel}} /></template>+ );await receiveChatMessageViaMessageBus();const newStatus = {@@ -145,7 +166,11 @@ module(});test("it deletes status on mentions on messages that came from Message Bus", async function (assert) {- await render(hbs`<ChatChannel @channel={{this.channel}} />`);+ const self = this;++ await render(+ <template><ChatChannel @channel={{self.channel}} /></template>+ );await receiveChatMessageViaMessageBus();this.appEvents.trigger("user-status:changed", {@@ -158,7 +183,13 @@ module(});test("it shows status tooltip", async function (assert) {- await render(hbs`<ChatChannel @channel={{this.channel}} /><DTooltips />`);+ const self = this;++ await render(+ <template>+ <ChatChannel @channel={{self.channel}} /><DTooltips />+ </template>+ );await triggerEvent(statusSelector(mentionedUser.username), "pointermove");assertdiff --git a/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjsindex 6c39be3e2a0..042ad4069ae 100644--- a/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-dropdown-test.gjs@@ -1,15 +1,19 @@import { click, render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatComposerDropdown from "discourse/plugins/chat/discourse/components/chat-composer-dropdown";module("Discourse Chat | Component | chat-composer-dropdown", function (hooks) {setupRenderingTest(hooks);test("buttons", async function (assert) {+ const self = this;+this.set("buttons", [{ id: "foo", icon: "xmark", action: () => {} }]);- await render(hbs`<ChatComposerDropdown @buttons={{this.buttons}} />`);+ await render(+ <template><ChatComposerDropdown @buttons={{self.buttons}} /></template>+ );await click(".chat-composer-dropdown__trigger-btn");assert.dom(".chat-composer-dropdown__item.foo").exists();diff --git a/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjsindex aee61441933..f99a5c76b69 100644--- a/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-message-details-test.gjs@@ -1,8 +1,8 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatComposerMessageDetails from "discourse/plugins/chat/discourse/components/chat-composer-message-details";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module(@@ -11,10 +11,14 @@ module(setupRenderingTest(hooks);test("data-id attribute", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message();await render(- hbs`<ChatComposerMessageDetails @message={{this.message}} />`+ <template>+ <ChatComposerMessageDetails @message={{self.message}} />+ </template>);assert@@ -23,35 +27,47 @@ module(});test("editing a message has the pencil icon", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({editing: true,});await render(- hbs`<ChatComposerMessageDetails @message={{this.message}} />`+ <template>+ <ChatComposerMessageDetails @message={{self.message}} />+ </template>);assert.dom(".chat-composer-message-details .d-icon-pencil").exists();});test("replying to a message has the reply icon", async function (assert) {+ const self = this;+const firstMessage = new ChatFabricators(getOwner(this)).message();this.message = new ChatFabricators(getOwner(this)).message({inReplyTo: firstMessage,});await render(- hbs`<ChatComposerMessageDetails @message={{this.message}} />`+ <template>+ <ChatComposerMessageDetails @message={{self.message}} />+ </template>);assert.dom(".chat-composer-message-details .d-icon-reply").exists();});test("displays user avatar", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message();await render(- hbs`<ChatComposerMessageDetails @message={{this.message}} />`+ <template>+ <ChatComposerMessageDetails @message={{self.message}} />+ </template>);assert@@ -60,20 +76,28 @@ module(});test("displays message excerpt", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message();await render(- hbs`<ChatComposerMessageDetails @message={{this.message}} />`+ <template>+ <ChatComposerMessageDetails @message={{self.message}} />+ </template>);assert.dom(".chat-reply__excerpt").hasText(this.message.excerpt);});test("displays user’s username", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message();await render(- hbs`<ChatComposerMessageDetails @message={{this.message}} />`+ <template>+ <ChatComposerMessageDetails @message={{self.message}} />+ </template>);assert.dom(".chat-reply__username").hasText(this.message.user.username);diff --git a/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjsindex ffb8386a079..1466238ab8c 100644--- a/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-placeholder-test.gjs@@ -1,9 +1,9 @@import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import pretender from "discourse/tests/helpers/create-pretender";import { i18n } from "discourse-i18n";+import Channel from "discourse/plugins/chat/discourse/components/chat/composer/channel";import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";module(@@ -12,6 +12,8 @@ module(setupRenderingTest(hooks);test("direct message to self shows Jot something down", async function (assert) {+ const self = this;+pretender.get("/emojis.json", () => [200, [], {}]);this.currentUser.set("id", 1);@@ -22,7 +24,7 @@ module(},});- await render(hbs`<Chat::Composer::Channel @channel={{this.channel}} />`);+ await render(<template><Channel @channel={{self.channel}} /></template>);assert.dom(".chat-composer__input")@@ -30,6 +32,8 @@ module(});test("direct message to multiple folks shows their names when not a group", async function (assert) {+ const self = this;+pretender.get("/emojis.json", () => [200, [], {}]);this.channel = ChatChannel.create({@@ -44,7 +48,7 @@ module(},});- await render(hbs`<Chat::Composer::Channel @channel={{this.channel}} />`);+ await render(<template><Channel @channel={{self.channel}} /></template>);assert.dom(".chat-composer__input")@@ -52,6 +56,8 @@ module(});test("direct message to group shows Chat in group", async function (assert) {+ const self = this;+pretender.get("/chat/emojis.json", () => [200, [], {}]);this.channel = ChatChannel.create({@@ -67,7 +73,7 @@ module(},});- await render(hbs`<Chat::Composer::Channel @channel={{this.channel}} />`);+ await render(<template><Channel @channel={{self.channel}} /></template>);assert.dom(".chat-composer__input")@@ -75,6 +81,8 @@ module(});test("message to channel shows send message to channel name", async function (assert) {+ const self = this;+pretender.get("/emojis.json", () => [200, [], {}]);this.channel = ChatChannel.create({@@ -82,7 +90,7 @@ module(title: "just-cats",});- await render(hbs`<Chat::Composer::Channel @channel={{this.channel}} />`);+ await render(<template><Channel @channel={{self.channel}} /></template>);assert.dom(".chat-composer__input")diff --git a/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjsindex 2e9695daed7..07d5ca636f7 100644--- a/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-upload-test.gjs@@ -1,33 +1,42 @@+import { fn } from "@ember/helper";import { click, render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";+import ChatComposerUpload from "discourse/plugins/chat/discourse/components/chat-composer-upload";module("Discourse Chat | Component | chat-composer-upload", function (hooks) {setupRenderingTest(hooks);test("file - uploading in progress", async function (assert) {+ const self = this;+this.set("upload", {progress: 50,extension: ".pdf",fileName: "test.pdf",});- await render(hbs`<ChatComposerUpload @upload={{this.upload}} />`);+ await render(+ <template><ChatComposerUpload @upload={{self.upload}} /></template>+ );assert.dom(".upload-progress[value='50']").exists();assert.dom(".uploading").hasText(i18n("uploading"));});test("image - uploading in progress", async function (assert) {+ const self = this;+this.set("upload", {extension: ".png",progress: 78,fileName: "test.png",});- await render(hbs`<ChatComposerUpload @upload={{this.upload}} />`);+ await render(+ <template><ChatComposerUpload @upload={{self.upload}} /></template>+ );assert.dom(".d-icon-far-image").exists();assert.dom(".upload-progress[value='78']").exists();@@ -35,6 +44,8 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {});test("image - preprocessing upload in progress", async function (assert) {+ const self = this;+this.set("upload", {extension: ".png",progress: 78,@@ -42,12 +53,16 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {processing: true,});- await render(hbs`<ChatComposerUpload @upload={{this.upload}} />`);+ await render(+ <template><ChatComposerUpload @upload={{self.upload}} /></template>+ );assert.dom(".processing").hasText(i18n("processing"));});test("file - upload complete", async function (assert) {+ const self = this;+this.set("upload", {type: ".pdf",original_filename: "some file.pdf",@@ -55,7 +70,9 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {});await render(- hbs`<ChatComposerUpload @isDone={{true}} @upload={{this.upload}} />`+ <template>+ <ChatComposerUpload @isDone={{true}} @upload={{self.upload}} />+ </template>);assert.dom(".d-icon-file-lines").exists();@@ -64,6 +81,8 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {});test("image - upload complete", async function (assert) {+ const self = this;+this.set("upload", {type: ".png",original_filename: "bar_image.png",@@ -72,13 +91,17 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {});await render(- hbs`<ChatComposerUpload @isDone={{true}} @upload={{this.upload}} />`+ <template>+ <ChatComposerUpload @isDone={{true}} @upload={{self.upload}} />+ </template>);assert.dom("img.preview-img[src='/images/avatar.png']").exists();});test("removing completed upload", async function (assert) {+ const self = this;+this.set("uploadRemoved", false);this.set("removeUpload", () => {this.set("uploadRemoved", true);@@ -91,7 +114,13 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {});await render(- hbs`<ChatComposerUpload @isDone={{true}} @upload={{this.upload}} @onCancel={{fn this.removeUpload this.upload}} />`+ <template>+ <ChatComposerUpload+ @isDone={{true}}+ @upload={{self.upload}}+ @onCancel={{fn self.removeUpload self.upload}}+ />+ </template>);await click(".chat-composer-upload__remove-btn");@@ -99,6 +128,8 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {});test("cancelling in progress upload", async function (assert) {+ const self = this;+this.set("uploadRemoved", false);this.set("removeUpload", () => {this.set("uploadRemoved", true);@@ -111,7 +142,12 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {});await render(- hbs`<ChatComposerUpload @upload={{this.upload}} @onCancel={{fn this.removeUpload this.upload}} />`+ <template>+ <ChatComposerUpload+ @upload={{self.upload}}+ @onCancel={{fn self.removeUpload self.upload}}+ />+ </template>);await click(".chat-composer-upload__remove-btn");diff --git a/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs b/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjsindex 5f1ca2ef77d..38d12ff933d 100644--- a/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-composer-uploads-test.gjs@@ -1,9 +1,9 @@import { click, render, waitFor } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import pretender from "discourse/tests/helpers/create-pretender";import { createFile } from "discourse/tests/helpers/qunit-helpers";+import ChatComposerUploads from "discourse/plugins/chat/discourse/components/chat-composer-uploads";const fakeUpload = {type: ".png",@@ -42,22 +42,36 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {setupRenderingTest(hooks);test("loading uploads from an outside source (e.g. draft or editing message)", async function (assert) {+ const self = this;+this.existingUploads = [fakeUpload];- await render(hbs`- <ChatComposerUploads @existingUploads={{this.existingUploads}} @fileUploadElementId="chat-widget-uploader" />- `);+ await render(+ <template>+ <ChatComposerUploads+ @existingUploads={{self.existingUploads}}+ @fileUploadElementId="chat-widget-uploader"+ />+ </template>+ );assert.dom(".chat-composer-upload").exists({ count: 1 });});test("upload starts and completes", async function (assert) {+ const self = this;+setupUploadPretender();this.set("onUploadChanged", () => {});- await render(hbs`- <ChatComposerUploads @fileUploadElementId="chat-widget-uploader" @onUploadChanged={{this.onUploadChanged}} />- `);+ await render(+ <template>+ <ChatComposerUploads+ @fileUploadElementId="chat-widget-uploader"+ @onUploadChanged={{self.onUploadChanged}}+ />+ </template>+ );const done = assert.async();this.appEvents = this.container.lookup("service:app-events");@@ -80,14 +94,22 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {});test("removing a completed upload", async function (assert) {+ const self = this;+this.set("changedUploads", null);this.set("onUploadChanged", () => {});this.existingUploads = [fakeUpload];- await render(hbs`- <ChatComposerUploads @existingUploads={{this.existingUploads}} @fileUploadElementId="chat-widget-uploader" @onUploadChanged={{this.onUploadChanged}} />- `);+ await render(+ <template>+ <ChatComposerUploads+ @existingUploads={{self.existingUploads}}+ @fileUploadElementId="chat-widget-uploader"+ @onUploadChanged={{self.onUploadChanged}}+ />+ </template>+ );assert.dom(".chat-composer-upload").exists({ count: 1 });@@ -97,6 +119,8 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {});test("cancelling in progress upload", async function (assert) {+ const self = this;+setupUploadPretender();this.set("changedUploads", null);@@ -104,9 +128,14 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {this.set("changedUploads", uploads);});- await render(hbs`- <ChatComposerUploads @fileUploadElementId="chat-widget-uploader" @onUploadChanged={{this.onUploadChanged}} />- `);+ await render(+ <template>+ <ChatComposerUploads+ @fileUploadElementId="chat-widget-uploader"+ @onUploadChanged={{self.onUploadChanged}}+ />+ </template>+ );const image = createFile("avatar.png");const done = assert.async();diff --git a/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs b/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjsindex 795f5f7e6df..97313587772 100644--- a/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-emoji-avatar-test.gjs@@ -1,15 +1,19 @@import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatEmojiAvatar from "discourse/plugins/chat/discourse/components/chat-emoji-avatar";module("Discourse Chat | Component | chat-emoji-avatar", function (hooks) {setupRenderingTest(hooks);test("uses an emoji as avatar", async function (assert) {+ const self = this;+this.set("emoji", ":otter:");- await render(hbs`<ChatEmojiAvatar @emoji={{this.emoji}} />`);+ await render(+ <template><ChatEmojiAvatar @emoji={{self.emoji}} /></template>+ );assert.dom(diff --git a/plugins/chat/test/javascripts/components/chat-header-icon-test.gjs b/plugins/chat/test/javascripts/components/chat-header-icon-test.gjsindex 6233198e3cc..16d77e3cbe5 100644--- a/plugins/chat/test/javascripts/components/chat-header-icon-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-header-icon-test.gjs@@ -1,9 +1,9 @@import { render } from "@ember/test-helpers";-import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import sinon from "sinon";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";+import Icon from "discourse/plugins/chat/discourse/components/chat/header/icon";import { HEADER_INDICATOR_PREFERENCE_ALL_NEW } from "discourse/plugins/chat/discourse/controllers/preferences-chat";module("Discourse Chat | Component | chat-header-icon", function (hooks) {@@ -15,7 +15,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {.stub(this.owner.lookup("service:chat-state-manager"), "isFullPageActive").value(true);- await render(hbs`<Chat::Header::Icon />`);+ await render(<template><Icon /></template>);assert.dom(".icon.btn-flat")@@ -31,7 +31,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {.stub(this.owner.lookup("service:chat-state-manager"), "isFullPageActive").value(true);- await render(hbs`<Chat::Header::Icon />`);+ await render(<template><Icon /></template>);assert.dom(".icon.btn-flat")@@ -44,7 +44,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {test("mobile", async function (assert) {this.site.mobileView = true;- await render(hbs`<Chat::Header::Icon />`);+ await render(<template><Icon /></template>);assert.dom(".icon.btn-flat")@@ -63,7 +63,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {.stub(this.owner.lookup("service:chat-state-manager"), "isFullPageActive").value(true);- await render(hbs`<Chat::Header::Icon @urgentCount={{1}} />`);+ await render(<template><Icon @urgentCount={{1}} /></template>);assert.dom(".icon.btn-flat")@@ -78,7 +78,7 @@ module("Discourse Chat | Component | chat-header-icon", function (hooks) {this.currentUser.user_option.chat_header_indicator_preference =HEADER_INDICATOR_PREFERENCE_ALL_NEW;- await render(hbs`<Chat::Header::Icon @urgentCount={{1}} />`);+ await render(<template><Icon @urgentCount={{1}} /></template>);assert.dom(".icon.btn-flat")diff --git a/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs b/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjsindex 479d8ecb8c1..8d697067892 100644--- a/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-avatar-test.gjs@@ -1,8 +1,8 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import Avatar from "discourse/plugins/chat/discourse/components/chat/message/avatar";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";@@ -10,6 +10,8 @@ module("Discourse Chat | Component | chat-message-avatar", function (hooks) {setupRenderingTest(hooks);test("chat_webhook_event", async function (assert) {+ const self = this;+this.message = ChatMessage.create(new ChatFabricators(getOwner(this)).channel(),{@@ -17,12 +19,14 @@ module("Discourse Chat | Component | chat-message-avatar", function (hooks) {});- await render(hbs`<Chat::Message::Avatar @message={{this.message}} />`);+ await render(<template><Avatar @message={{self.message}} /></template>);assert.dom(".chat-emoji-avatar .emoji").hasAttribute("title", "heart");});test("user", async function (assert) {+ const self = this;+this.message = ChatMessage.create(new ChatFabricators(getOwner(this)).channel(),{@@ -30,7 +34,7 @@ module("Discourse Chat | Component | chat-message-avatar", function (hooks) {});- await render(hbs`<Chat::Message::Avatar @message={{this.message}} />`);+ await render(<template><Avatar @message={{self.message}} /></template>);assert.dom('.chat-user-avatar [data-user-card="discobot"]').exists();});diff --git a/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs b/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjsindex 168c7396d6c..880dc62ca10 100644--- a/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-collapser-test.gjs@@ -1,8 +1,8 @@import { click, render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, skip, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { queryAll } from "discourse/tests/helpers/qunit-helpers";+import ChatMessageCollapser from "discourse/plugins/chat/discourse/components/chat-message-collapser";const youtubeCooked ="<p>written text</p>" +@@ -50,8 +50,12 @@ module("Discourse Chat | Component | chat message collapser", function (hooks) {setupRenderingTest(hooks);test("escapes uploads header", async function (assert) {+ const self = this;+this.set("uploads", [{ original_filename: evilString }]);- await render(hbs`<ChatMessageCollapser @uploads={{this.uploads}} />`);+ await render(+ <template><ChatMessageCollapser @uploads={{self.uploads}} /></template>+ );assert.dom(".chat-message-collapser-link-small")@@ -65,6 +69,8 @@ module(setupRenderingTest(hooks);test("escapes youtube header", async function (assert) {+ const self = this;+this.set("cooked",youtubeCooked.replace(@@ -72,7 +78,9 @@ module(`https://www.youtube.com/watch?v=${evilString}`));- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );assert.dom(".chat-message-collapser-link")@@ -83,9 +91,13 @@ module(});test("shows youtube link in header", async function (assert) {+ const self = this;+this.set("cooked", youtubeCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const link = queryAll(".chat-message-collapser-link");@@ -99,10 +111,14 @@ module(});test("shows all user written text", async function (assert) {+ const self = this;+youtubeCooked.youtubeid;this.set("cooked", youtubeCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const text = queryAll(".chat-message-collapser p");@@ -117,9 +133,13 @@ module(});test("collapses and expands cooked youtube", async function (assert) {+ const self = this;+this.set("cooked", youtubeCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const youtubeDivs = queryAll(".youtube-onebox");@@ -173,11 +193,18 @@ module(const imageTextCooked = "<p>A picture of Tomtom</p>";test("shows filename for one image", async function (assert) {+ const self = this;+this.set("cooked", imageTextCooked);this.set("uploads", [{ original_filename: "tomtom.jpeg" }]);await render(- hbs`<ChatMessageCollapser @cooked={{this.cooked}} @uploads={{this.uploads}} />`+ <template>+ <ChatMessageCollapser+ @cooked={{self.cooked}}+ @uploads={{self.uploads}}+ />+ </template>);assert@@ -186,17 +213,26 @@ module(});test("shows number of files for multiple images", async function (assert) {+ const self = this;+this.set("cooked", imageTextCooked);this.set("uploads", [{}, {}]);await render(- hbs`<ChatMessageCollapser @cooked={{this.cooked}} @uploads={{this.uploads}} />`+ <template>+ <ChatMessageCollapser+ @cooked={{self.cooked}}+ @uploads={{self.uploads}}+ />+ </template>);assert.dom(".chat-message-collapser-link-small").includesText("2 files");});test("collapses and expands images", async function (assert) {+ const self = this;+this.set("cooked", imageTextCooked);this.set("uploads", [{@@ -208,7 +244,12 @@ module(]);await render(- hbs`<ChatMessageCollapser @cooked={{this.cooked}} @uploads={{this.uploads}} />`+ <template>+ <ChatMessageCollapser+ @cooked={{self.cooked}}+ @uploads={{self.uploads}}+ />+ </template>);assert.dom(".chat-uploads").isVisible();@@ -231,9 +272,13 @@ module(setupRenderingTest(hooks);test("shows links for animated image", async function (assert) {+ const self = this;+this.set("cooked", animatedImageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const links = queryAll("a.chat-message-collapser-link-small");@@ -247,9 +292,13 @@ module(});test("shows all user written text", async function (assert) {+ const self = this;+this.set("cooked", animatedImageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const text = queryAll(".chat-message-collapser p");@@ -260,9 +309,13 @@ module(});test("collapses and expands animated image onebox", async function (assert) {+ const self = this;+this.set("cooked", animatedImageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const animatedOneboxes = queryAll(".animated.onebox");@@ -303,9 +356,13 @@ module(setupRenderingTest(hooks);test("shows links for animated image", async function (assert) {+ const self = this;+this.set("cooked", externalImageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const links = queryAll("a.chat-message-collapser-link-small");@@ -317,9 +374,13 @@ module(});test("shows all user written text", async function (assert) {+ const self = this;+this.set("cooked", externalImageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const text = queryAll(".chat-message-collapser p");@@ -330,9 +391,13 @@ module(});test("collapses and expands image oneboxes", async function (assert) {+ const self = this;+this.set("cooked", externalImageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const imageOneboxes = queryAll(".onebox");@@ -373,13 +438,17 @@ module(setupRenderingTest(hooks);skip("escapes link", async function (assert) {+ const self = this;+this.set("cooked",imageCooked.replace("shows alt", evilString).replace("/images/d-logo-sketch-small.png", evilString));- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const links = [...document.querySelectorAll(".chat-message-collapser-link-small"),@@ -392,9 +461,13 @@ module(});test("shows alt or links (if no alt) for linked image", async function (assert) {+ const self = this;+this.set("cooked", imageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const links = queryAll("a.chat-message-collapser-link-small");@@ -408,9 +481,13 @@ module(});test("shows all user written text", async function (assert) {+ const self = this;+this.set("cooked", imageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const text = queryAll(".chat-message-collapser p");@@ -421,9 +498,13 @@ module(});test("collapses and expands images", async function (assert) {+ const self = this;+this.set("cooked", imageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const images = queryAll("img");@@ -457,9 +538,13 @@ module(});test("does not show collapser for emoji images", async function (assert) {+ const self = this;+this.set("cooked", imageCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const links = queryAll("a.chat-message-collapser-link-small");const images = queryAll("img");@@ -478,13 +563,17 @@ module(setupRenderingTest(hooks);test("escapes title/link", async function (assert) {+ const self = this;+this.set("cooked",galleryCooked.replace("https://imgur.com/gallery/yyVx5lJ", evilString).replace("Le tomtom album", evilString));- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );assert.dom(".chat-message-collapser-link-small")@@ -493,17 +582,25 @@ module(});test("removes album title overlay", async function (assert) {+ const self = this;+this.set("cooked", galleryCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );assert.dom(".album-title").doesNotExist("album title removed");});test("shows gallery link", async function (assert) {+ const self = this;+this.set("cooked", galleryCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );assert.dom(".chat-message-collapser-link-small")@@ -511,9 +608,13 @@ module(});test("shows all user written text", async function (assert) {+ const self = this;+this.set("cooked", galleryCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );const text = queryAll(".chat-message-collapser p");@@ -523,9 +624,13 @@ module(});test("collapses and expands images", async function (assert) {+ const self = this;+this.set("cooked", galleryCooked);- await render(hbs`<ChatMessageCollapser @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageCollapser @cooked={{self.cooked}} /></template>+ );assert.dom("img").isVisible("image visible initially");diff --git a/plugins/chat/test/javascripts/components/chat-message-info-test.gjs b/plugins/chat/test/javascripts/components/chat-message-info-test.gjsindex 14ee35fb07c..80e7f7f6b19 100644--- a/plugins/chat/test/javascripts/components/chat-message-info-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-info-test.gjs@@ -1,26 +1,26 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import Bookmark from "discourse/models/bookmark";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";+import Info from "discourse/plugins/chat/discourse/components/chat/message/info";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";module("Discourse Chat | Component | chat-message-info", function (hooks) {setupRenderingTest(hooks);- const template = hbs`- <Chat::Message::Info @message={{this.message}} @show={{true}} />- `;-test("chat_webhook_event", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({chat_webhook_event: { username: "discobot" },});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__username")@@ -29,11 +29,15 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {});test("user", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({user: { username: "discobot" },});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__username")@@ -41,17 +45,23 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {});test("date", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({user: { username: "discobot" },created_at: moment(),});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__date").exists();});test("bookmark (with reminder)", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({user: { username: "discobot" },bookmark: Bookmark.create({@@ -60,7 +70,9 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {}),});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__bookmark .d-icon-discourse-bookmark-clock")@@ -68,6 +80,8 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {});test("bookmark (no reminder)", async function (assert) {+ const self = this;+this.message = ChatMessage.create(new ChatFabricators(getOwner(this)).channel(),{@@ -78,29 +92,39 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__bookmark .d-icon-bookmark").exists();});test("user status", async function (assert) {+ const self = this;+const status = { description: "off to dentist", emoji: "tooth" };this.message = new ChatFabricators(getOwner(this)).message({user: { status },});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__status .user-status-message").exists();});test("flag status", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({user: { username: "discobot" },user_flag_status: 0,});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__flag > .svg-icon-title")@@ -108,12 +132,16 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {});test("reviewable", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({user: { username: "discobot" },user_flag_status: 0,});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__flag > .svg-icon-title")@@ -121,6 +149,8 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {});test("with username classes", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({user: {username: "discobot",@@ -131,7 +161,9 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {},});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__username.is-staff").exists();assert.dom(".chat-message-info__username.is-admin").exists();@@ -141,11 +173,15 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {});test("without username classes", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({user: { username: "discobot" },});- await render(template);+ await render(+ <template><Info @message={{self.message}} @show={{true}} /></template>+ );assert.dom(".chat-message-info__username.is-staff").doesNotExist();assert.dom(".chat-message-info__username.is-admin").doesNotExist();diff --git a/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs b/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjsindex ed7e5f44792..bd122d4edc8 100644--- a/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-left-gutter-test.gjs@@ -1,10 +1,10 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import CoreFabricators from "discourse/lib/fabricators";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";+import LeftGutter from "discourse/plugins/chat/discourse/components/chat/message/left-gutter";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module(@@ -12,24 +12,28 @@ module(function (hooks) {setupRenderingTest(hooks);- const template = hbs`- <Chat::Message::LeftGutter @message={{this.message}} />- `;-test("default", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message();- await render(template);+ await render(+ <template><LeftGutter @message={{self.message}} /></template>+ );assert.dom(".chat-message-left-gutter__date").exists();});test("with reviewable", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({reviewable_id: 1,});- await render(template);+ await render(+ <template><LeftGutter @message={{self.message}} /></template>+ );assert.dom(".chat-message-left-gutter__flag .svg-icon-title")@@ -37,11 +41,15 @@ module(});test("with flag status", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({user_flag_status: 0,});- await render(template);+ await render(+ <template><LeftGutter @message={{self.message}} /></template>+ );assert.dom(".chat-message-left-gutter__flag .svg-icon-title")@@ -49,11 +57,15 @@ module(});test("bookmark", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({bookmark: new CoreFabricators(getOwner(this)).bookmark(),});- await render(template);+ await render(+ <template><LeftGutter @message={{self.message}} /></template>+ );assert.dom(".chat-message-left-gutter__date").exists();assert.dom(".chat-message-left-gutter__bookmark").exists();diff --git a/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs b/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjsindex f47e02560c1..980adf37ee8 100644--- a/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-reaction-test.gjs@@ -1,38 +1,55 @@+import { hash } from "@ember/helper";import { click, render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatMessageReaction from "discourse/plugins/chat/discourse/components/chat-message-reaction";module("Discourse Chat | Component | chat-message-reaction", function (hooks) {setupRenderingTest(hooks);test("adds reacted class when user reacted", async function (assert) {- await render(hbs`- <ChatMessageReaction @reaction={{hash emoji="heart" reacted=true}} />- `);+ await render(+ <template>+ <ChatMessageReaction @reaction={{hash emoji="heart" reacted=true}} />+ </template>+ );assert.dom(".chat-message-reaction.reacted").exists();});test("adds reaction name as class", async function (assert) {- await render(hbs`<ChatMessageReaction @reaction={{hash emoji="heart"}} />`);+ await render(+ <template>+ <ChatMessageReaction @reaction={{hash emoji="heart"}} />+ </template>+ );assert.dom(`.chat-message-reaction[data-emoji-name="heart"]`).exists();});test("title/alt attributes", async function (assert) {- await render(hbs`<ChatMessageReaction @reaction={{hash emoji="heart"}} />`);+ await render(+ <template>+ <ChatMessageReaction @reaction={{hash emoji="heart"}} />+ </template>+ );assert.dom(".chat-message-reaction").hasAttribute("title", ":heart:");assert.dom(".chat-message-reaction img").hasAttribute("alt", ":heart:");});test("count of reactions", async function (assert) {+ const self = this;+this.set("count", 0);- await render(hbs`- <ChatMessageReaction @reaction={{hash emoji="heart" count=this.count}} />- `);+ await render(+ <template>+ <ChatMessageReaction+ @reaction={{hash emoji="heart" count=self.count}}+ />+ </template>+ );assert.dom(".chat-message-reaction .count").doesNotExist();@@ -41,20 +58,32 @@ module("Discourse Chat | Component | chat-message-reaction", function (hooks) {});test("reaction’s image", async function (assert) {- await render(hbs`<ChatMessageReaction @reaction={{hash emoji="heart"}} />`);+ await render(+ <template>+ <ChatMessageReaction @reaction={{hash emoji="heart"}} />+ </template>+ );assert.dom(".chat-message-reaction img").hasAttribute("src", /heart\.png/);});test("click action", async function (assert) {+ const self = this;+this.set("count", 0);this.set("react", () => {this.set("count", 1);});- await render(hbs`- <ChatMessageReaction class="show" @reaction={{hash emoji="heart" count=this.count}} @onReaction={{this.react}} />- `);+ await render(+ <template>+ <ChatMessageReaction+ class="show"+ @reaction={{hash emoji="heart" count=self.count}}+ @onReaction={{self.react}}+ />+ </template>+ );assert.dom(".chat-message-reaction .count").doesNotExist();diff --git a/plugins/chat/test/javascripts/components/chat-message-test.gjs b/plugins/chat/test/javascripts/components/chat-message-test.gjsindex a3a7e41baab..72fd4e66abe 100644--- a/plugins/chat/test/javascripts/components/chat-message-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-test.gjs@@ -1,33 +1,37 @@import { getOwner } from "@ember/owner";import { clearRender, render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import CoreFabricators from "discourse/lib/fabricators";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatMessage from "discourse/plugins/chat/discourse/components/chat-message";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module("Discourse Chat | Component | chat-message", function (hooks) {setupRenderingTest(hooks);- const template = hbs`- <ChatMessage @message={{this.message}} />- `;-test("Message with edits", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({edited: true,});- await render(template);+ await render(+ <template><ChatMessage @message={{self.message}} /></template>+ );assert.dom(".chat-message-edited").exists("has the correct css class");});test("Deleted message", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({user: this.currentUser,deleted_at: moment(),});- await render(template);+ await render(+ <template><ChatMessage @message={{self.message}} /></template>+ );assert.dom(".chat-message-text.-deleted .chat-message-expand")@@ -35,10 +39,14 @@ module("Discourse Chat | Component | chat-message", function (hooks) {});test("Hidden message", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({hidden: true,});- await render(template);+ await render(+ <template><ChatMessage @message={{self.message}} /></template>+ );assert.dom(".chat-message-text.-hidden .chat-message-expand")@@ -46,22 +54,30 @@ module("Discourse Chat | Component | chat-message", function (hooks) {});test("Message by a bot", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({message: "what <mark>test</mark>",user: new CoreFabricators(getOwner(this)).user({ id: -10 }),});await this.message.cook();- await render(template);+ await render(+ <template><ChatMessage @message={{self.message}} /></template>+ );assert.dom(".chat-message-container.is-bot").exists("has the bot class");});test("Message with mark html tag", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({message: "what <mark>test</mark>",});await this.message.cook();- await render(template);+ await render(+ <template><ChatMessage @message={{self.message}} /></template>+ );assert.dom(".chat-message-text")@@ -69,10 +85,14 @@ module("Discourse Chat | Component | chat-message", function (hooks) {});test("Message with reply", async function (assert) {+ const self = this;+this.message = new ChatFabricators(getOwner(this)).message({inReplyTo: new ChatFabricators(getOwner(this)).message(),});- await render(template);+ await render(+ <template><ChatMessage @message={{self.message}} /></template>+ );assert.dom(".chat-message-container.has-reply")@@ -80,6 +100,8 @@ module("Discourse Chat | Component | chat-message", function (hooks) {});test("Message with streaming", async function (assert) {+ const self = this;+// adminthis.currentUser.admin = true;@@ -88,7 +110,9 @@ module("Discourse Chat | Component | chat-message", function (hooks) {streaming: true,});await this.message.cook();- await render(template);+ await render(+ <template><ChatMessage @message={{self.message}} /></template>+ );assert.dom(".stop-streaming-btn")@@ -104,7 +128,9 @@ module("Discourse Chat | Component | chat-message", function (hooks) {streaming: true,});await this.message.cook();- await render(template);+ await render(+ <template><ChatMessage @message={{self.message}} /></template>+ );assert.dom(".stop-streaming-btn")@@ -122,7 +148,9 @@ module("Discourse Chat | Component | chat-message", function (hooks) {streaming: true,});await this.message.cook();- await render(template);+ await render(+ <template><ChatMessage @message={{self.message}} /></template>+ );assert.dom(".stop-streaming-btn")diff --git a/plugins/chat/test/javascripts/components/chat-message-text-test.gjs b/plugins/chat/test/javascripts/components/chat-message-text-test.gjsindex ab3364dd672..e12debed1d6 100644--- a/plugins/chat/test/javascripts/components/chat-message-text-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-message-text-test.gjs@@ -1,62 +1,82 @@import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatMessageText from "discourse/plugins/chat/discourse/components/chat-message-text";module("Discourse Chat | Component | chat-message-text", function (hooks) {setupRenderingTest(hooks);test("yields", async function (assert) {+ const self = this;+this.set("cooked", "<p></p>");- await render(hbs`- <ChatMessageText @cooked={{this.cooked}} @uploads={{this.uploads}}>- <div class="yield-me"></div>- </ChatMessageText>- `);+ await render(+ <template>+ <ChatMessageText @cooked={{self.cooked}} @uploads={{self.uploads}}>+ <div class="yield-me"></div>+ </ChatMessageText>+ </template>+ );assert.dom(".yield-me").exists();});test("shows collapsed", async function (assert) {+ const self = this;+this.set("cooked",'<div class="youtube-onebox lazy-video-container" data-video-id="WaT_rLGuUr8" data-video-title="Japanese Katsu Curry (Pork Cutlet)" data-provider-name="youtube"/>');await render(- hbs`<ChatMessageText @cooked={{this.cooked}} @uploads={{this.uploads}} />`+ <template>+ <ChatMessageText @cooked={{self.cooked}} @uploads={{self.uploads}} />+ </template>);assert.dom(".chat-message-collapser").exists();});test("does not collapse a non-image onebox", async function (assert) {+ const self = this;+this.set("cooked", '<p><a href="http://cat1.com" class="onebox"></a></p>');- await render(hbs`<ChatMessageText @cooked={{this.cooked}} />`);+ await render(+ <template><ChatMessageText @cooked={{self.cooked}} /></template>+ );assert.dom(".chat-message-collapser").doesNotExist();});test("shows edits - regular message", async function (assert) {+ const self = this;+this.set("cooked", "<p></p>");await render(- hbs`<ChatMessageText @cooked={{this.cooked}} @edited={{true}} />`+ <template>+ <ChatMessageText @cooked={{self.cooked}} @edited={{true}} />+ </template>);assert.dom(".chat-message-edited").exists();});test("shows edits - collapsible message", async function (assert) {+ const self = this;+this.set("cooked",'<div class="youtube-onebox lazy-video-container"></div>');await render(- hbs`<ChatMessageText @cooked={{this.cooked}} @edited={{true}} />`+ <template>+ <ChatMessageText @cooked={{self.cooked}} @edited={{true}} />+ </template>);assert.dom(".chat-message-edited").exists();diff --git a/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjsindex f0012a7633b..cb60d2d61d6 100644--- a/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-modal-archive-channel-test.gjs@@ -1,8 +1,9 @@+import { hash } from "@ember/helper";import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ArchiveChannel from "discourse/plugins/chat/discourse/components/chat/modal/archive-channel";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module(@@ -11,12 +12,19 @@ module(setupRenderingTest(hooks);test("channel title is escaped in instructions correctly", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel({title: `<script>someeviltitle</script>`,});await render(- hbs`<Chat::Modal::ArchiveChannel @inline={{true}} @model={{hash channel=this.channel}} />`+ <template>+ <ArchiveChannel+ @inline={{true}}+ @model={{hash channel=self.channel}}+ />+ </template>);assertdiff --git a/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjsindex 942609ddf25..5d915f9cb4e 100644--- a/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-modal-delete-channel-test.gjs@@ -1,8 +1,9 @@+import { hash } from "@ember/helper";import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import DeleteChannel from "discourse/plugins/chat/discourse/components/chat/modal/delete-channel";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module(@@ -11,12 +12,19 @@ module(setupRenderingTest(hooks);test("channel title is escaped in instructions correctly", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel({title: `<script>someeviltitle</script>`,});await render(- hbs`<Chat::Modal::DeleteChannel @inline={{true}} @model={{hash channel=this.channel}} />`+ <template>+ <DeleteChannel+ @inline={{true}}+ @model={{hash channel=self.channel}}+ />+ </template>);assertdiff --git a/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs b/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjsindex 411ecdb3174..6977ae147b7 100644--- a/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-modal-move-message-to-channel-test.gjs@@ -1,8 +1,9 @@+import { hash } from "@ember/helper";import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import MoveMessageToChannel from "discourse/plugins/chat/discourse/components/chat/modal/move-message-to-channel";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module(@@ -11,17 +12,24 @@ module(setupRenderingTest(hooks);test("channel title is escaped in instructions correctly", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel({title: "<script>someeviltitle</script>",});this.selectedMessageIds = [this.channel.id];- await render(hbs`- <Chat::Modal::MoveMessageToChannel- @inline={{true}}- @model={{hash sourceChannel=this.channel selectedMessageIds=this.selectedMessageIds}}- />- `);+ await render(+ <template>+ <MoveMessageToChannel+ @inline={{true}}+ @model={{hash+ sourceChannel=self.channel+ selectedMessageIds=self.selectedMessageIds+ }}+ />+ </template>+ );assert.dom(".chat-modal-move-message-to-channel")diff --git a/plugins/chat/test/javascripts/components/chat-notices-test.gjs b/plugins/chat/test/javascripts/components/chat-notices-test.gjsindex ee64b221898..ae3e0282fe3 100644--- a/plugins/chat/test/javascripts/components/chat-notices-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-notices-test.gjs@@ -1,17 +1,19 @@import { getOwner } from "@ember/owner";import { click, render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import pretender from "discourse/tests/helpers/create-pretender";import { queryAll } from "discourse/tests/helpers/qunit-helpers";import { i18n } from "discourse-i18n";+import ChatNotices from "discourse/plugins/chat/discourse/components/chat-notices";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module("Discourse Chat | Component | chat-notice", function (hooks) {setupRenderingTest(hooks);test("displays all notices for a channel", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel();this.manager = this.container.lookup("service:chat-channel-notices-manager"@@ -29,7 +31,9 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {text_content: "N/A",});- await render(hbs`<ChatNotices @channel={{this.channel}} />`);+ await render(+ <template><ChatNotices @channel={{self.channel}} /></template>+ );const notices = queryAll(".chat-notices .chat-notices__notice");@@ -40,6 +44,8 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {});test("Notices can be cleared", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel();this.manager = this.container.lookup("service:chat-channel-notices-manager"@@ -49,7 +55,9 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {text_content: "hello",});- await render(hbs`<ChatNotices @channel={{this.channel}} />`);+ await render(+ <template><ChatNotices @channel={{self.channel}} /></template>+ );assert.strictEqual(queryAll(".chat-notices .chat-notices__notice").length,@@ -66,6 +74,8 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {);});test("MentionWithoutMembership notice renders", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel();this.manager = this.container.lookup("service:chat-channel-notices-manager"@@ -77,7 +87,9 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {data: { user_ids: [1], message_id: 1, text },});- await render(hbs`<ChatNotices @channel={{this.channel}} />`);+ await render(+ <template><ChatNotices @channel={{self.channel}} /></template>+ );assert.strictEqual(queryAll(diff --git a/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs b/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjsindex ef3b6e0fd7e..0d6de2c6b81 100644--- a/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-replying-indicator-test.gjs@@ -1,12 +1,12 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import {joinChannel,leaveChannel,} from "discourse/tests/helpers/presence-pretender";+import ChatReplyingIndicator from "discourse/plugins/chat/discourse/components/chat-replying-indicator";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";async function addUser(id, username, channelName = "/chat-reply/1") {@@ -30,7 +30,9 @@ module(test("not displayed when no one is replying", async function (assert) {await render(- hbs`<ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />`+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>);assert.dom(".chat-replying-indicator__text").doesNotExist();@@ -38,7 +40,11 @@ module(test("working for thread", async function (assert) {await render(- hbs`<ChatReplyingIndicator @presenceChannelName="/chat-reply/1/thread/1" />`+ <template>+ <ChatReplyingIndicator+ @presenceChannelName="/chat-reply/1/thread/1"+ />+ </template>);await addUser(1, "sam", "/chat-reply/1/thread/1");@@ -48,10 +54,14 @@ module(test("doesn’t leak in other indicators", async function (assert) {await render(- hbs`- <div class="channel"><ChatReplyingIndicator @presenceChannelName="/chat-reply/1" /></div>- <div class="thread"><ChatReplyingIndicator @presenceChannelName="/chat-reply/1/thread/1" /></div>- `+ <template>+ <div class="channel"><ChatReplyingIndicator+ @presenceChannelName="/chat-reply/1"+ /></div>+ <div class="thread"><ChatReplyingIndicator+ @presenceChannelName="/chat-reply/1/thread/1"+ /></div>+ </template>);await addUser(1, "sam");@@ -72,7 +82,9 @@ module(test("displays indicator when user is replying", async function (assert) {await render(- hbs`<ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />`+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>);await addUser(1, "sam");@@ -84,7 +96,9 @@ module(this.channel = new ChatFabricators(getOwner(this)).channel();await render(- hbs`<ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />`+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>);await addUser(1, "sam");@@ -99,7 +113,9 @@ module(this.channel = new ChatFabricators(getOwner(this)).channel();await render(- hbs`<ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />`+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>);await addUser(1, "sam");@@ -115,7 +131,9 @@ module(this.channel = new ChatFabricators(getOwner(this)).channel();await render(- hbs`<ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />`+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>);await addUser(1, "sam");@@ -132,7 +150,9 @@ module(this.channel = new ChatFabricators(getOwner(this)).channel();await render(- hbs`<ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />`+ <template>+ <ChatReplyingIndicator @presenceChannelName="/chat-reply/1" />+ </template>);await addUser(1, "sam");@@ -142,12 +162,18 @@ module(});test("resets presence when channel changes", async function (assert) {+ const self = this;+this.set("presenceChannelName", "/chat-reply/1");await addUser(1, "sam");await render(- hbs`<ChatReplyingIndicator @presenceChannelName={{this.presenceChannelName}} />`+ <template>+ <ChatReplyingIndicator+ @presenceChannelName={{self.presenceChannelName}}+ />+ </template>);assert.dom(".chat-replying-indicator__text").hasText("sam is typing");diff --git a/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs b/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjsindex 052477961fe..3df50c496d0 100644--- a/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-retention-reminder-test.gjs@@ -1,8 +1,8 @@import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";+import ChatRetentionReminder from "discourse/plugins/chat/discourse/components/chat-retention-reminder";import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";module(@@ -11,10 +11,14 @@ module(setupRenderingTest(hooks);test("display retention info", async function (assert) {+ const self = this;+this.channel = ChatChannel.create({ chatable_type: "Category" });this.currentUser.set("needs_channel_retention_reminder", true);- await render(hbs`<ChatRetentionReminder @channel={{this.channel}} />`);+ await render(+ <template><ChatRetentionReminder @channel={{self.channel}} /></template>+ );assert.dom(".chat-retention-reminder").includesText(i18n("chat.retention_reminders.long", {@@ -24,11 +28,15 @@ module(});test("@type=short", async function (assert) {+ const self = this;+this.channel = ChatChannel.create({ chatable_type: "Category" });this.currentUser.set("needs_channel_retention_reminder", true);await render(- hbs`<ChatRetentionReminder @channel={{this.channel}} @type="short" />`+ <template>+ <ChatRetentionReminder @channel={{self.channel}} @type="short" />+ </template>);assert.dom(".chat-retention-reminder").includesText(diff --git a/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs b/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjsindex 887a738a130..638f76fd6ef 100644--- a/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-retention-reminder-text-test.gjs@@ -1,9 +1,9 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import { i18n } from "discourse-i18n";+import ChatRetentionReminderText from "discourse/plugins/chat/discourse/components/chat-retention-reminder-text";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module(@@ -12,11 +12,15 @@ module(setupRenderingTest(hooks);test("when setting is set on 0", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel();this.siteSettings.chat_channel_retention_days = 0;await render(- hbs`<ChatRetentionReminderText @channel={{this.channel}} />`+ <template>+ <ChatRetentionReminderText @channel={{self.channel}} />+ </template>);assert@@ -24,7 +28,9 @@ module(.includesText(i18n("chat.retention_reminders.indefinitely_long"));await render(- hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`+ <template>+ <ChatRetentionReminderText @channel={{self.channel}} @type="short" />+ </template>);assert@@ -33,11 +39,15 @@ module(});test("when channel is a public channel", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).channel();this.siteSettings.chat_channel_retention_days = 10;await render(- hbs`<ChatRetentionReminderText @channel={{this.channel}} />`+ <template>+ <ChatRetentionReminderText @channel={{self.channel}} />+ </template>);assert@@ -45,7 +55,9 @@ module(.includesText(i18n("chat.retention_reminders.long", { count: 10 }));await render(- hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`+ <template>+ <ChatRetentionReminderText @channel={{self.channel}} @type="short" />+ </template>);assert@@ -54,11 +66,15 @@ module(});test("when channel is a DM channel", async function (assert) {+ const self = this;+this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();this.siteSettings.chat_dm_retention_days = 10;await render(- hbs`<ChatRetentionReminderText @channel={{this.channel}} />`+ <template>+ <ChatRetentionReminderText @channel={{self.channel}} />+ </template>);assert@@ -66,7 +82,9 @@ module(.includesText(i18n("chat.retention_reminders.long", { count: 10 }));await render(- hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`+ <template>+ <ChatRetentionReminderText @channel={{self.channel}} @type="short" />+ </template>);assertdiff --git a/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-header-test.gjsindex 77e7637faf8..03871c89572 100644--- a/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-thread-header-test.gjs@@ -1,20 +1,24 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import Header from "discourse/plugins/chat/discourse/components/chat/thread/header";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module("Discourse Chat | Component | chat-thread-header", function (hooks) {setupRenderingTest(hooks);test("it safely renders title", async function (assert) {+ const self = this;+const title = "<style>body { background: red;}</style>";this.thread = new ChatFabricators(getOwner(this)).thread({ title });- await render(hbs`- <Chat::Thread::Header @thread={{this.thread}} @channel={{this.thread.channel}} />- `);+ await render(+ <template>+ <Header @thread={{self.thread}} @channel={{self.thread.channel}} />+ </template>+ );assert.dom(".c-navbar__title")diff --git a/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjsindex f62e2e6ba6a..eeee55ffc3a 100644--- a/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-thread-list-item-test.gjs@@ -1,20 +1,20 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import Item from "discourse/plugins/chat/discourse/components/chat/thread-list/item";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module("Discourse Chat | Component | chat-thread-list-item", function (hooks) {setupRenderingTest(hooks);test("it safely renders title", async function (assert) {+ const self = this;+const title = "<style>body { background: red;}</style>";this.thread = new ChatFabricators(getOwner(this)).thread({ title });- await render(hbs`- <Chat::ThreadList::Item @thread={{this.thread}} />- `);+ await render(<template><Item @thread={{self.thread}} /></template>);assert.dom(".chat-thread-list-item__title")diff --git a/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs b/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjsindex 8e30580deae..5ba56f5ce2c 100644--- a/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-thread-participants-test.gjs@@ -1,9 +1,9 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import CoreFabricators from "discourse/lib/fabricators";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatThreadParticipants from "discourse/plugins/chat/discourse/components/chat-thread-participants";import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";module(@@ -12,13 +12,19 @@ module(setupRenderingTest(hooks);test("no participants", async function (assert) {+ const self = this;+this.thread = new ChatFabricators(getOwner(this)).thread();- await render(hbs`<ChatThreadParticipants @thread={{this.thread}} />`);+ await render(+ <template><ChatThreadParticipants @thread={{self.thread}} /></template>+ );assert.dom(".chat-thread-participants").doesNotExist();});test("@includeOriginalMessageUser=true", async function (assert) {+ const self = this;+const originalMessageUser = new CoreFabricators(getOwner(this)).user({username: "bob",});@@ -35,12 +41,16 @@ module(}),});- await render(hbs`<ChatThreadParticipants @thread={{this.thread}} />`);+ await render(+ <template><ChatThreadParticipants @thread={{self.thread}} /></template>+ );assert.dom(".chat-user-avatar[data-username]").exists({ count: 2 });});test("@includeOriginalMessageUser=false", async function (assert) {+ const self = this;+const originalMessageUser = new CoreFabricators(getOwner(this)).user({username: "bob",});@@ -58,7 +68,12 @@ module(});await render(- hbs`<ChatThreadParticipants @thread={{this.thread}} @includeOriginalMessageUser={{false}} />`+ <template>+ <ChatThreadParticipants+ @thread={{self.thread}}+ @includeOriginalMessageUser={{false}}+ />+ </template>);assert.dom('.chat-user-avatar[data-username="bob"]').doesNotExist();diff --git a/plugins/chat/test/javascripts/components/chat-upload-test.gjs b/plugins/chat/test/javascripts/components/chat-upload-test.gjsindex 2e70dcf79c9..2e41a8e049e 100644--- a/plugins/chat/test/javascripts/components/chat-upload-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-upload-test.gjs@@ -1,7 +1,7 @@import { render, triggerEvent } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatUpload from "discourse/plugins/chat/discourse/components/chat-upload";const IMAGE_FIXTURE = {id: 290,@@ -68,9 +68,11 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {setupRenderingTest(hooks);test("with an image", async function (assert) {+ const self = this;+this.set("upload", IMAGE_FIXTURE);- await render(hbs`<ChatUpload @upload={{this.upload}} />`);+ await render(<template><ChatUpload @upload={{self.upload}} /></template>);assert.dom("img.chat-img-upload").exists("displays as an image");assert@@ -95,9 +97,11 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {});test("with a video", async function (assert) {+ const self = this;+this.set("upload", VIDEO_FIXTURE);- await render(hbs`<ChatUpload @upload={{this.upload}} />`);+ await render(<template><ChatUpload @upload={{self.upload}} /></template>);assert.dom("video.chat-video-upload").exists("displays as an video");assert.dom("video.chat-video-upload").hasAttribute("controls");@@ -111,9 +115,11 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {});test("with a audio", async function (assert) {+ const self = this;+this.set("upload", AUDIO_FIXTURE);- await render(hbs`<ChatUpload @upload={{this.upload}} />`);+ await render(<template><ChatUpload @upload={{self.upload}} /></template>);assert.dom("audio.chat-audio-upload").exists("displays as an audio");assert.dom("audio.chat-audio-upload").hasAttribute("controls");@@ -127,9 +133,11 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {});test("non image upload", async function (assert) {+ const self = this;+this.set("upload", TXT_FIXTURE);- await render(hbs`<ChatUpload @upload={{this.upload}} />`);+ await render(<template><ChatUpload @upload={{self.upload}} /></template>);assert.dom("a.chat-other-upload").exists("displays as a link");assertdiff --git a/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs b/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjsindex 2043dcb4b3c..bfeefb93d1f 100644--- a/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-user-avatar-test.gjs@@ -1,9 +1,9 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import CoreFabricators from "discourse/lib/fabricators";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatUserAvatar from "discourse/plugins/chat/discourse/components/chat-user-avatar";function containerSelector(user, options = {}) {let onlineSelector = ":not(.is-online)";@@ -18,47 +18,67 @@ module("Discourse Chat | Component | <ChatUserAvatar />", function (hooks) {setupRenderingTest(hooks);test("when user is not online", async function (assert) {+ const self = this;+this.user = new CoreFabricators(getOwner(this)).user();this.chat = { presenceChannel: { users: [] } };await render(- hbs`<ChatUserAvatar @chat={{this.chat}} @user={{this.user}} />`+ <template>+ <ChatUserAvatar @chat={{self.chat}} @user={{self.user}} />+ </template>);assert.dom(containerSelector(this.user, { online: false })).exists();});test("user is online", async function (assert) {+ const self = this;+this.user = new CoreFabricators(getOwner(this)).user();this.chat = {presenceChannel: { users: [{ id: this.user.id }] },};await render(- hbs`<ChatUserAvatar @chat={{this.chat}} @user={{this.user}} />`+ <template>+ <ChatUserAvatar @chat={{self.chat}} @user={{self.user}} />+ </template>);assert.dom(containerSelector(this.user, { online: true })).exists();});test("@showPresence=false", async function (assert) {+ const self = this;+this.user = new CoreFabricators(getOwner(this)).user();this.chat = {presenceChannel: { users: [{ id: this.user.id }] },};await render(- hbs`<ChatUserAvatar @showPresence={{false}} @chat={{this.chat}} @user={{this.user}} />`+ <template>+ <ChatUserAvatar+ @showPresence={{false}}+ @chat={{self.chat}}+ @user={{self.user}}+ />+ </template>);assert.dom(containerSelector(this.user, { online: false })).exists();});test("@interactive=true", async function (assert) {+ const self = this;+this.user = new CoreFabricators(getOwner(this)).user();await render(- hbs`<ChatUserAvatar @interactive={{false}} @user={{this.user}} />`+ <template>+ <ChatUserAvatar @interactive={{false}} @user={{self.user}} />+ </template>);assert.dom(".clickable").doesNotExist();diff --git a/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs b/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjsindex aebf2afd6d4..4d556b5546d 100644--- a/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-user-card-button-test.gjs@@ -1,10 +1,10 @@import { getOwner } from "@ember/owner";import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import sinon from "sinon";import CoreFabricators from "discourse/lib/fabricators";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import DirectMessageButton from "discourse/plugins/chat/discourse/components/chat/direct-message-button";module("Discourse Chat | Component | <Chat::DirectMessageButton />",@@ -12,26 +12,34 @@ module(setupRenderingTest(hooks);test("when current user can send direct messages", async function (assert) {+ const self = this;+sinon.stub(this.owner.lookup("service:chat"), "userCanDirectMessage").value(true);this.user = new CoreFabricators(getOwner(this)).user();await render(- hbs`<Chat::DirectMessageButton @user={{this.user}} @modal={{true}} />`+ <template>+ <DirectMessageButton @user={{self.user}} @modal={{true}} />+ </template>);assert.dom(".chat-direct-message-btn").exists("it shows the chat button");});test("when current user can’t send direct messages", async function (assert) {+ const self = this;+sinon.stub(this.owner.lookup("service:chat"), "userCanDirectMessage").value(false);this.user = new CoreFabricators(getOwner(this)).user();await render(- hbs`<Chat::DirectMessageButton @user={{this.user}} @modal={{true}} />`+ <template>+ <DirectMessageButton @user={{self.user}} @modal={{true}} />+ </template>);assert@@ -40,6 +48,8 @@ module(});test("when displayed user has disabled PMs / DMs", async function (assert) {+ const self = this;+sinon.stub(this.owner.lookup("service:chat"), "userCanDirectMessage").value(true);@@ -49,7 +59,9 @@ module(});await render(- hbs`<Chat::DirectMessageButton @user={{this.user}} @modal={{true}} />`+ <template>+ <DirectMessageButton @user={{self.user}} @modal={{true}} />+ </template>);assertdiff --git a/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs b/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjsindex 659e02ef7f2..cb53e32af94 100644--- a/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-user-display-name-test.gjs@@ -1,7 +1,7 @@import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatUserDisplayName from "discourse/plugins/chat/discourse/components/chat-user-display-name";module("Discourse Chat | Component | chat-user-display-name | prioritize username in UX",@@ -9,19 +9,27 @@ module(setupRenderingTest(hooks);test("username and no name", async function (assert) {+ const self = this;+this.siteSettings.prioritize_username_in_ux = true;this.set("user", { username: "bob", name: null });- await render(hbs`<ChatUserDisplayName @user={{this.user}} />`);+ await render(+ <template><ChatUserDisplayName @user={{self.user}} /></template>+ );assert.dom(".chat-user-display-name").hasText("bob");});test("username and name", async function (assert) {+ const self = this;+this.siteSettings.prioritize_username_in_ux = true;this.set("user", { username: "bob", name: "Bobcat" });- await render(hbs`<ChatUserDisplayName @user={{this.user}} />`);+ await render(+ <template><ChatUserDisplayName @user={{self.user}} /></template>+ );assert.dom(".chat-user-display-name").hasText("bob Bobcat");});@@ -34,19 +42,27 @@ module(setupRenderingTest(hooks);test("no name", async function (assert) {+ const self = this;+this.siteSettings.prioritize_username_in_ux = false;this.set("user", { username: "bob", name: null });- await render(hbs`<ChatUserDisplayName @user={{this.user}} />`);+ await render(+ <template><ChatUserDisplayName @user={{self.user}} /></template>+ );assert.dom(".chat-user-display-name").hasText("bob");});test("name and username", async function (assert) {+ const self = this;+this.siteSettings.prioritize_username_in_ux = false;this.set("user", { username: "bob", name: "Bobcat" });- await render(hbs`<ChatUserDisplayName @user={{this.user}} />`);+ await render(+ <template><ChatUserDisplayName @user={{self.user}} /></template>+ );assert.dom(".chat-user-display-name").hasText("Bobcat bob");});diff --git a/plugins/chat/test/javascripts/components/chat-user-info-test.gjs b/plugins/chat/test/javascripts/components/chat-user-info-test.gjsindex 38eaa4711ec..f4675cfa3fc 100644--- a/plugins/chat/test/javascripts/components/chat-user-info-test.gjs+++ b/plugins/chat/test/javascripts/components/chat-user-info-test.gjs@@ -1,21 +1,25 @@import { render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import ChatUserInfo from "discourse/plugins/chat/discourse/components/chat-user-info";module("Discourse Chat | Component | chat-user-info", function (hooks) {setupRenderingTest(hooks);test("avatar and name", async function (assert) {+ const self = this;+this.set("user", this.currentUser);- await render(hbs`<ChatUserInfo @user={{this.user}} />`);+ await render(<template><ChatUserInfo @user={{self.user}} /></template>);assert.dom().containsText(this.user.username);assert.dom().containsText(this.user.name);});test("status message", async function (assert) {+ const self = this;+this.siteSettings.enable_user_status = true;this.set("user", this.currentUser);@@ -25,7 +29,13 @@ module("Discourse Chat | Component | chat-user-info", function (hooks) {});await render(- hbs`<ChatUserInfo @user={{this.user}} @showStatus={{true}} @showStatusDescription={{true}} />`+ <template>+ <ChatUserInfo+ @user={{self.user}}+ @showStatus={{true}}+ @showStatusDescription={{true}}+ />+ </template>);assert.dom("img.emoji[alt='smile']").exists("it shows the emoji");diff --git a/plugins/chat/test/javascripts/components/collapser-test.gjs b/plugins/chat/test/javascripts/components/collapser-test.gjsindex bc95bb93b2a..a721964588a 100644--- a/plugins/chat/test/javascripts/components/collapser-test.gjs+++ b/plugins/chat/test/javascripts/components/collapser-test.gjs@@ -1,26 +1,30 @@import { htmlSafe } from "@ember/template";import { click, render } from "@ember/test-helpers";-import hbs from "htmlbars-inline-precompile";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import Collapser from "discourse/plugins/chat/discourse/components/collapser";module("Discourse Chat | Component | collapser", function (hooks) {setupRenderingTest(hooks);test("renders header", async function (assert) {+ const self = this;+this.set("header", htmlSafe(`<div class="cat">tomtom</div>`));- await render(hbs`<Collapser @header={{this.header}} />`);+ await render(<template><Collapser @header={{self.header}} /></template>);assert.dom(".cat").exists();});test("collapses and expands yielded body", async function (assert) {- await render(hbs`- <Collapser>- <div class="cat">body text</div>- </Collapser>- `);+ await render(+ <template>+ <Collapser>+ <div class="cat">body text</div>+ </Collapser>+ </template>+ );assert.dom(".cat").isVisible();diff --git a/plugins/chat/test/javascripts/integration/components/user-menu/chat-notifications-list-test.gjs b/plugins/chat/test/javascripts/integration/components/user-menu/chat-notifications-list-test.gjsindex 64d8c34be54..b05cde2f14f 100644--- a/plugins/chat/test/javascripts/integration/components/user-menu/chat-notifications-list-test.gjs+++ b/plugins/chat/test/javascripts/integration/components/user-menu/chat-notifications-list-test.gjs@@ -1,9 +1,9 @@import { render } from "@ember/test-helpers";-import { hbs } from "ember-cli-htmlbars";import { module, test } from "qunit";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import pretender, { response } from "discourse/tests/helpers/create-pretender";import { i18n } from "discourse-i18n";+import ChatNotificationsList from "discourse/plugins/chat/discourse/components/user-menu/chat-notifications-list";module("Integration | Component | user-menu | chat-notifications-list",@@ -16,7 +16,7 @@ module(});});- const template = hbs`<UserMenu::ChatNotificationsList/>`;+ const template = <template><ChatNotificationsList /></template>;test("empty state when there are no notifications", async function (assert) {await render(template);