diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-title.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-title.hbs
index 1e8958d0bf1..712abf29dbd 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-title.hbs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-title.hbs
@@ -7,7 +7,7 @@
{{@channel.chatable.users.length}}
{{else}}
-
+
{{/if}}
{{/if}}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.hbs
index eac795d3fc8..3415ca32d0f 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.hbs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer-message-details.hbs
@@ -5,7 +5,7 @@
>
-
-
-
- {{avatar @user imageSize=this.avatarSize}}
-
-
\ No newline at end of file
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/user-avatar.js b/plugins/chat/assets/javascripts/discourse/components/chat/user-avatar.js
deleted file mode 100644
index b4a616d78c9..00000000000
--- a/plugins/chat/assets/javascripts/discourse/components/chat/user-avatar.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import Component from "@glimmer/component";
-import { inject as service } from "@ember/service";
-
-export default class ChatUserAvatar extends Component {
- @service chat;
-
- get avatarSize() {
- return this.args.avatarSize || "tiny";
- }
-
- get showPresence() {
- return this.args.showPresence ?? true;
- }
-
- get isOnline() {
- const users = (this.args.chat || this.chat).presenceChannel?.users;
-
- return (
- this.showPresence &&
- !!users?.find(
- ({ id, username }) =>
- this.args.user?.id === id || this.args.user?.username === username
- )
- );
- }
-}
diff --git a/plugins/chat/assets/stylesheets/common/chat-thread-list-item.scss b/plugins/chat/assets/stylesheets/common/chat-thread-list-item.scss
index d282a171500..68604427481 100644
--- a/plugins/chat/assets/stylesheets/common/chat-thread-list-item.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-thread-list-item.scss
@@ -75,6 +75,8 @@
align-items: center;
gap: 0.5rem;
.chat-user-avatar {
+ cursor: pointer;
+
&__container {
padding: 0;
}
diff --git a/plugins/chat/spec/fabricators/chat_fabricator.rb b/plugins/chat/spec/fabricators/chat_fabricator.rb
index 59b7c3bac86..14b1d9ea0ae 100644
--- a/plugins/chat/spec/fabricators/chat_fabricator.rb
+++ b/plugins/chat/spec/fabricators/chat_fabricator.rb
@@ -63,7 +63,7 @@ end
Fabricator(:chat_message_without_service, class_name: "Chat::Message") do
user
chat_channel
- message { Faker::Lorem.paragraph_by_chars(number: 500).gsub("...", "…") }
+ message { Faker::Lorem.paragraph_by_chars(number: 500).gsub("...", "…").gsub("..", "…") }
after_build { |message, attrs| message.cook }
after_create { |message, attrs| message.create_mentions }
@@ -90,7 +90,8 @@ Fabricator(:chat_message_with_service, class_name: "Chat::CreateMessage") do
chat_channel_id: channel.id,
guardian: user.guardian,
message:
- transients[:message] || Faker::Lorem.paragraph_by_chars(number: 500).gsub("...", "…"),
+ transients[:message] ||
+ Faker::Lorem.paragraph_by_chars(number: 500).gsub("...", "…").gsub("..", "…"),
thread_id: transients[:thread]&.id,
in_reply_to_id: transients[:in_reply_to]&.id,
upload_ids: transients[:upload_ids],
diff --git a/plugins/chat/spec/system/page_objects/chat/components/thread_indicator.rb b/plugins/chat/spec/system/page_objects/chat/components/thread_indicator.rb
index 7eab3824b68..5f6a69c2308 100644
--- a/plugins/chat/spec/system/page_objects/chat/components/thread_indicator.rb
+++ b/plugins/chat/spec/system/page_objects/chat/components/thread_indicator.rb
@@ -33,7 +33,7 @@ module PageObjects
def has_participant?(user)
find(@context).has_css?(
- ".chat-thread-participants__avatar-group .chat-user-avatar .chat-user-avatar__container[data-user-card=\"#{user.username}\"] img",
+ ".chat-thread-participants__avatar-group .chat-user-avatar[data-username=\"#{user.username}\"] img",
)
end
diff --git a/plugins/chat/test/javascripts/components/chat-thread-participants-test.js b/plugins/chat/test/javascripts/components/chat-thread-participants-test.js
index a3632b1cb71..c83d512e372 100644
--- a/plugins/chat/test/javascripts/components/chat-thread-participants-test.js
+++ b/plugins/chat/test/javascripts/components/chat-thread-participants-test.js
@@ -5,18 +5,18 @@ import { render } from "@ember/test-helpers";
import { module, test } from "qunit";
module(
- "Discourse Chat | Component |
",
+ "Discourse Chat | Component |
",
function (hooks) {
setupRenderingTest(hooks);
test("no participants", async function (assert) {
this.thread = fabricators.thread();
- await render(hbs`
`);
+ await render(hbs`
`);
assert.dom(".chat-thread-participants").doesNotExist();
});
- test("includeOriginalMessageUser=true", async function (assert) {
+ test("@includeOriginalMessageUser=true", async function (assert) {
const orignalMessageUser = fabricators.user({ username: "bob" });
this.thread = fabricators.thread({
original_message: fabricators.message({ user: orignalMessageUser }),
@@ -29,13 +29,12 @@ module(
}),
});
- await render(hbs`
`);
+ await render(hbs`
`);
- assert.dom('.chat-user-avatar [data-user-card="bob"]').exists();
- assert.dom('.chat-user-avatar [data-user-card="alice"]').exists();
+ assert.dom(".chat-user-avatar[data-username]").exists({ count: 2 });
});
- test("includeOriginalMessageUser=false", async function (assert) {
+ test("@includeOriginalMessageUser=false", async function (assert) {
const orignalMessageUser = fabricators.user({ username: "bob" });
this.thread = fabricators.thread({
original_message: fabricators.message({ user: orignalMessageUser }),
@@ -49,11 +48,11 @@ module(
});
await render(
- hbs`
`
+ hbs`
`
);
- assert.dom('.chat-user-avatar [data-user-card="bob"]').doesNotExist();
- assert.dom('.chat-user-avatar [data-user-card="alice"]').exists();
+ assert.dom('.chat-user-avatar[data-username="bob"]').doesNotExist();
+ assert.dom('.chat-user-avatar[data-username="alice"]').exists();
});
}
);
diff --git a/plugins/chat/test/javascripts/components/chat-user-avatar-test.js b/plugins/chat/test/javascripts/components/chat-user-avatar-test.js
index 342ec3d3aae..f306e7c7b4a 100644
--- a/plugins/chat/test/javascripts/components/chat-user-avatar-test.js
+++ b/plugins/chat/test/javascripts/components/chat-user-avatar-test.js
@@ -13,15 +13,15 @@ function containerSelector(user, options = {}) {
return `.chat-user-avatar${onlineSelector} .chat-user-avatar__container[data-user-card=${user.username}] .avatar[title=${user.username}]`;
}
-module("Discourse Chat | Component |
", function (hooks) {
+module("Discourse Chat | Component |
", function (hooks) {
setupRenderingTest(hooks);
- test("user is not online", async function (assert) {
+ test("when user is not online", async function (assert) {
this.user = fabricators.user();
this.chat = { presenceChannel: { users: [] } };
await render(
- hbs`
`
+ hbs`
`
);
assert.dom(containerSelector(this.user, { online: false })).exists();
@@ -34,22 +34,32 @@ module("Discourse Chat | Component |
", function (hooks) {
};
await render(
- hbs`
`
+ hbs`
`
);
assert.dom(containerSelector(this.user, { online: true })).exists();
});
- test("showPresence=false", async function (assert) {
+ test("@showPresence=false", async function (assert) {
this.user = fabricators.user();
this.chat = {
presenceChannel: { users: [{ id: this.user.id }] },
};
await render(
- hbs`
`
+ hbs`
`
);
assert.dom(containerSelector(this.user, { online: false })).exists();
});
+
+ test("@interactive=true", async function (assert) {
+ this.user = fabricators.user();
+
+ await render(
+ hbs`
`
+ );
+
+ assert.dom(".clickable").doesNotExist();
+ });
});