UX: Update Chat Group Name and Placeholder (#28703)

* UX: Update Chat Group Name and Placeholder

* update tests

* fix failing tests

* better checking of system user when setting dm title
This commit is contained in:
David Battersby
2024-09-04 09:52:23 +04:00
committed by GitHub
parent 93564bfa7d
commit fdcf4698fc
5 changed files with 39 additions and 13 deletions

View File

@ -4,6 +4,7 @@ import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import pretender from "discourse/tests/helpers/create-pretender";
import { query } from "discourse/tests/helpers/qunit-helpers";
import I18n from "discourse-i18n";
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
module(
@ -30,13 +31,13 @@ module(
);
});
test("direct message to multiple folks shows their names", async function (assert) {
test("direct message to multiple folks shows their names when not a group", async function (assert) {
pretender.get("/chat/emojis.json", () => [200, [], {}]);
this.channel = ChatChannel.create({
chatable_type: "DirectMessage",
chatable: {
group: true,
group: false,
users: [
{ name: "Tomtom" },
{ name: "Steaky" },
@ -53,6 +54,30 @@ module(
);
});
test("direct message to group shows Chat in group", async function (assert) {
pretender.get("/chat/emojis.json", () => [200, [], {}]);
this.channel = ChatChannel.create({
chatable_type: "DirectMessage",
title: "Meetup Chat",
chatable: {
group: true,
users: [
{ username: "user1" },
{ username: "user2" },
{ username: "user3" },
],
},
});
await render(hbs`<Chat::Composer::Channel @channel={{this.channel}} />`);
assert.strictEqual(
query(".chat-composer__input").placeholder,
I18n.t("chat.placeholder_group")
);
});
test("message to channel shows send message to channel name", async function (assert) {
pretender.get("/chat/emojis.json", () => [200, [], {}]);