Skip to content

A platform for community discussion. Free, open, simple.

DEV: When chat is full page, scroll user cards with the avatar (#34556)

Gary Pendergastc333888e01f2
diff --git a/app/assets/javascripts/discourse/app/components/card-contents-base.js b/app/assets/javascripts/discourse/app/components/card-contents-base.js
index 09e3a8bbb76..f4548be6710 100644
--- a/app/assets/javascripts/discourse/app/components/card-contents-base.js
+++ b/app/assets/javascripts/discourse/app/components/card-contents-base.js
@@ -194,12 +194,17 @@ export default class CardContentsBase extends Component {
return this._show(target.innerText.replace(/^@/, ""), target, event);
}
+ get autoUpdateCard() {
+ return this.cardTarget.dataset["autoUpdateCard"] === "true";
+ }
+
_positionCard(target) {
schedule("afterRender", async () => {
if (this.site.desktopView) {
this._menuInstance = await this.menu.show(target, {
content: this.element,
- autoUpdate: false,
+ autoUpdate: this.autoUpdateCard,
+ hide: this.autoUpdateCard,
identifier: "usercard",
padding: {
top: 10 + AVATAR_OVERFLOW_SIZE + headerOffset(),
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-user-avatar.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-user-avatar.gjs
index b7b04c6312e..8e776f45483 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-user-avatar.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-user-avatar.gjs
@@ -6,6 +6,7 @@ import { renderAvatar } from "discourse/helpers/user-avatar";
import { userPath } from "discourse/lib/url";
export default class ChatUserAvatar extends Component {
+ @service chatStateManager;
@service chat;
get avatar() {
@@ -42,6 +43,10 @@ export default class ChatUserAvatar extends Component {
return userPath(this.args.user.username);
}
+ get isFullPageActive() {
+ return this.chatStateManager.isFullPageActive ? "true" : "false";
+ }
+
<template>
<div
class={{concatClass "chat-user-avatar" (if this.isOnline "is-online")}}
@@ -52,6 +57,7 @@ export default class ChatUserAvatar extends Component {
class="chat-user-avatar__container"
href={{this.userPath}}
data-user-card={{@user.username}}
+ data-auto-update-card={{this.isFullPageActive}}
>
{{this.avatar}}
</a>