Skip to content

Commit 2a00e50

Browse files
matt2eclaude
andcommitted
fix(messages): drop the message link's fragment guard the names view now owns
Rebasing onto main brought in #1927, which makes every identity-names resolver drop fallback (key-fragment) profile names. The link's own fragment comparison is dead, and the test premise that the names view hands back the fragment no longer holds. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Matt Toohey <[email protected]>
1 parent 1930b32 commit 2a00e50

2 files changed

Lines changed: 5 additions & 18 deletions

File tree

‎src/features/conversation/linked-message.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ it("never names an author by a key fragment, and names them once their profile d
248248
]),
249249
agents: [{ pubkey: agent, name: "Builder" }],
250250
});
251-
// The app's names view hands back the fragment for a profile with no name.
252-
expect(app.session.names.resolve(alice)).toBe(alice.slice(0, 10));
251+
// The app's names view drops the fragment of a profile with no name.
252+
expect(app.session.names.resolve(alice, "")).toBe("");
253253
render(
254254
<>
255255
{link(app.session, href(id(1)))}

‎src/features/conversation/linked-message.ts‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -207,26 +207,13 @@ export function useLinkedMessageByline(
207207
id ? session : undefined,
208208
channelId,
209209
);
210-
// A fallback profile name is a key fragment, whichever resolver returns it.
211-
const fragment = useSyncExternalStore(
212-
(id && session?.profiles.subscribe) || noop,
213-
() => {
214-
const profile = id ? session?.profiles.snapshot().get(id) : undefined;
215-
return profile?.nameIsFallback ? profile.name : "";
216-
},
217-
() => "",
218-
);
219210
useEffect(() => {
220211
if (id && session)
221212
void session.profiles.ensure([id], "background").catch(() => {});
222213
}, [session, id]);
223-
// An author with no name yet keeps the channel presentation, never a key.
224-
const resolved = id ? resolveName(id, "") : "";
225-
const name = author?.workflow
226-
? "Workflow"
227-
: resolved === fragment
228-
? ""
229-
: resolved;
214+
// An author with no name yet keeps the channel presentation, never a key:
215+
// the names view drops fallback (key-fragment) profile names itself.
216+
const name = author?.workflow ? "Workflow" : id ? resolveName(id, "") : "";
230217
return channel && name ? `${name} in #${channel}` : undefined;
231218
}
232219

0 commit comments

Comments
 (0)