Skip to content

Commit a945765

Browse files
fix(ui): keep the presence viewer exclusion through the extraction
Extracting sessionPresenceViewers dropped the excludeUserId filter, so the chat header would count the session owner it already renders as another watcher. Requiring every worktree field also left the typography fixtures short an id.
1 parent acb1f6e commit a945765

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

‎ui/src/components/viewer-facepile.ts‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,23 @@ export function projectPresencePayload(
109109
}
110110

111111
/** Other people currently watching this session, for surfaces that name them
112-
* rather than stack their avatars. */
112+
* rather than stack their avatars. excludeUserId drops a viewer the caller
113+
* already renders on its own (the header owner chip), so the same person is
114+
* never both named there and counted here as "someone else is watching". */
113115
export function sessionPresenceViewers(
114116
value: unknown,
115117
authenticatedSelfUserId: string | undefined,
116118
selfInstanceId: string | undefined,
117119
sessionKey: string,
120+
excludeUserId?: string,
118121
): readonly PresenceViewer[] {
119122
const projection = projectPresencePayload(value, authenticatedSelfUserId, selfInstanceId);
123+
const excludedUserId = normalized(excludeUserId);
120124
return projection.users.filter(
121-
(user) => user.id !== projection.selfUserId && user.watchedSessions.includes(sessionKey),
125+
(user) =>
126+
user.id !== projection.selfUserId &&
127+
user.id !== excludedUserId &&
128+
user.watchedSessions.includes(sessionKey),
122129
);
123130
}
124131

@@ -127,9 +134,16 @@ export function hasSessionPresenceViewers(
127134
authenticatedSelfUserId: string | undefined,
128135
selfInstanceId: string | undefined,
129136
sessionKey: string,
137+
excludeUserId?: string,
130138
): boolean {
131139
return (
132-
sessionPresenceViewers(value, authenticatedSelfUserId, selfInstanceId, sessionKey).length > 0
140+
sessionPresenceViewers(
141+
value,
142+
authenticatedSelfUserId,
143+
selfInstanceId,
144+
sessionKey,
145+
excludeUserId,
146+
).length > 0
133147
);
134148
}
135149

‎ui/src/e2e/sidebar-typography.e2e.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ suite.define(() => {
7474
pinned: true,
7575
unread: true,
7676
worktree: {
77+
id: "pinned-handoff",
7778
branch: "feat/pinned-handoff",
7879
repoRoot: "/workspace/openclaw",
7980
},
@@ -84,6 +85,7 @@ suite.define(() => {
8485
category: "Research",
8586
childSessions: [childKey],
8687
worktree: {
88+
id: "release-plan",
8789
branch: "feat/release-plan",
8890
repoRoot: "/workspace/openclaw",
8991
},

0 commit comments

Comments
 (0)