A platform for community discussion. Free, open, simple.
FIX: channel member status live updates (#25925)
David Battersby88f833418f86
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-user-info.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-user-info.gjsindex 3a02e015ac0..76fa342e91f 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-user-info.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-user-info.gjs@@ -1,10 +1,19 @@import Component from "@glimmer/component";+import { modifier } from "ember-modifier";import UserStatusMessage from "discourse/components/user-status-message";import { userPath } from "discourse/lib/url";import ChatUserAvatar from "discourse/plugins/chat/discourse/components/chat-user-avatar";import ChatUserDisplayName from "discourse/plugins/chat/discourse/components/chat-user-display-name";export default class ChatUserInfo extends Component {+ trackUserStatus = modifier((element, [user]) => {+ user.statusManager.trackStatus();++ return () => {+ user.statusManager.stopTrackingStatus();+ };+ });+get avatarSize() {return this.args.avatarSize ?? "medium";}@@ -42,10 +51,12 @@ export default class ChatUserInfo extends Component {{{/if}}{{#if this.showStatus}}- <UserStatusMessage- @status={{@user.status}}- @showDescription={{this.showStatusDescription}}- />+ <div class="user-status" {{this.trackUserStatus @user}}>+ <UserStatusMessage+ @status={{@user.status}}+ @showDescription={{this.showStatusDescription}}+ />+ </div>{{/if}}{{/if}}</template>diff --git a/plugins/chat/test/javascripts/components/chat-user-info-test.js b/plugins/chat/test/javascripts/components/chat-user-info-test.jsindex 26e06e5fab7..38eaa4711ec 100644--- a/plugins/chat/test/javascripts/components/chat-user-info-test.js+++ b/plugins/chat/test/javascripts/components/chat-user-info-test.js@@ -14,4 +14,21 @@ module("Discourse Chat | Component | chat-user-info", function (hooks) {assert.dom().containsText(this.user.username);assert.dom().containsText(this.user.name);});++ test("status message", async function (assert) {+ this.siteSettings.enable_user_status = true;++ this.set("user", this.currentUser);++ this.user.setProperties({+ status: { description: "happy", emoji: "smile" },+ });++ await render(+ hbs`<ChatUserInfo @user={{this.user}} @showStatus={{true}} @showStatusDescription={{true}} />`+ );++ assert.dom("img.emoji[alt='smile']").exists("it shows the emoji");+ assert.dom().containsText("happy");+ });});