From 02b88ae7325833b6014cfee7842a73db815e6a42 Mon Sep 17 00:00:00 2001 From: mister_papaye Date: Mon, 14 Sep 2026 18:58:41 +0200 Subject: [PATCH 1/5] feat(mentions): add @everyone/@here and make mentions resolve to real users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mentions previously rendered any "@word" typed in a message as a styled mention tag, with no click behavior — so arbitrary text could look like a mention, and real mentions weren't clickable. Centralize the logic in useMentions.ts: only tokens that resolve to a real org member (or the new special "everyone"/"here" tokens) get highlighted, clicking a user mention opens their profile, and "you were mentioned" detection now matches pseudo or name consistently with what the composer actually inserts. @here highlights for a mentioned user only while they're online. Also escapes message text before it's reinjected as innerHTML during mention rendering, closing a latent HTML-injection path in the previous implementation. Co-Authored-By: Claude Sonnet 5 --- src/components/common/MentionsList.vue | 17 +- src/composables/useMentions.ts | 185 ++++++++++++++++++ .../components/common/ChatMessage.vue | 59 ++---- .../components/common/ThreadMessage.vue | 59 ++---- .../components/common/ThreadTextarea.vue | 13 +- 5 files changed, 236 insertions(+), 97 deletions(-) create mode 100644 src/composables/useMentions.ts diff --git a/src/components/common/MentionsList.vue b/src/components/common/MentionsList.vue index e0d53d11..0899031e 100644 --- a/src/components/common/MentionsList.vue +++ b/src/components/common/MentionsList.vue @@ -18,7 +18,13 @@ index === activeIndex ? 'bg-(--primary)/20 text-(--primary)' : 'hover:bg-white/5' ]" > -
+
+ +
+
{{ $p(user.name).charAt(0).toUpperCase() }}
@@ -26,7 +32,7 @@ @{{ user.pseudo }}
- +
@@ -34,11 +40,12 @@ diff --git a/src/views/OrgSpace/components/dropdown/UserDropDown.vue b/src/views/OrgSpace/components/dropdown/UserDropDown.vue index 61deedf4..baec1d6c 100644 --- a/src/views/OrgSpace/components/dropdown/UserDropDown.vue +++ b/src/views/OrgSpace/components/dropdown/UserDropDown.vue @@ -2,7 +2,7 @@ import type { User } from '@/types/types'; import DropDown from '@/components/DropDown.vue'; -import useWSocket from '@/composables/useWSocket'; +import useWSocket, { disconnectSocket } from '@/composables/useWSocket'; import { openedOrg } from '@/assets/var'; import { keycloak } from '@/assets/keycloak'; import { computed, ref, watch } from 'vue'; @@ -194,7 +194,7 @@ const setStatus = async (status: 'online' | 'idle' | 'dnd' | 'offline') => {
-
diff --git a/src/views/OrgsSelection/OrgSelection.vue b/src/views/OrgsSelection/OrgSelection.vue index d7cc2fc8..67c1ffef 100644 --- a/src/views/OrgsSelection/OrgSelection.vue +++ b/src/views/OrgsSelection/OrgSelection.vue @@ -9,6 +9,7 @@ import Popup from '@/components/Popup.vue'; import IconSelector from '@/components/common/IconSelector.vue'; import { useToast } from '@/composables/useToast'; import { keycloak } from '@/assets/keycloak'; +import { disconnectSocket } from '@/composables/useWSocket'; import DropDown from '@/components/DropDown.vue'; import UserSettings from '@/components/windows/UserSettings.vue'; @@ -129,7 +130,7 @@ onMounted(async () => {
-
From 91e706283ebf038bf71a760defcbf42733a0ae37 Mon Sep 17 00:00:00 2001 From: mister_papaye Date: Mon, 14 Sep 2026 19:28:02 +0200 Subject: [PATCH 5/5] fix(mentions): guard against undefined regex capture group MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TS flagged match[1] as possibly undefined in extractMentionTokens, blocking the build. The capture group in MENTION_TOKEN_REGEX is non-optional so it always matches whenever the overall pattern does, but TS can't infer that — skip the (impossible in practice) undefined case explicitly instead of asserting past it. Co-Authored-By: Claude Sonnet 5 --- src/composables/useMentions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/composables/useMentions.ts b/src/composables/useMentions.ts index c29a85cc..a86b631b 100644 --- a/src/composables/useMentions.ts +++ b/src/composables/useMentions.ts @@ -72,7 +72,7 @@ export const extractMentionTokens = (content: string | undefined | null): string const tokens: string[] = []; for (const match of content.matchAll(MENTION_TOKEN_REGEX)) { - tokens.push(normalize(match[1])); + if (match[1]) tokens.push(normalize(match[1])); } return tokens;