diff --git a/desktop/src/features/profile/lib/identity.ts b/desktop/src/features/profile/lib/identity.ts index 45866ec3c..95d9b0aeb 100644 --- a/desktop/src/features/profile/lib/identity.ts +++ b/desktop/src/features/profile/lib/identity.ts @@ -26,6 +26,19 @@ export function formatVerifiedUserLabel( return chosen || verified || null; } +export function formatVerifiedProfileLabel( + profile: + | Pick + | null + | undefined, +): string | null { + return formatVerifiedUserLabel( + profile?.displayName, + profile?.verifiedName, + profile?.verifiedNameExpiresAt, + ); +} + /** * Deep-equal two profile lookups by value. Used to stabilise the merged * `messageProfiles` reference at the ChannelScreen boundary: the underlying diff --git a/desktop/src/features/sidebar/ui/AppSidebar.tsx b/desktop/src/features/sidebar/ui/AppSidebar.tsx index 222bb8e86..5d5c15378 100644 --- a/desktop/src/features/sidebar/ui/AppSidebar.tsx +++ b/desktop/src/features/sidebar/ui/AppSidebar.tsx @@ -52,7 +52,7 @@ import type { } from "@/features/sidebar/ui/AppSidebar.types"; import { SidebarRelayConnectionCard } from "@/features/sidebar/ui/SidebarRelayConnectionCard"; import type { useSidebarRelayConnectionCard } from "@/features/sidebar/ui/useSidebarRelayConnectionCard"; -import { formatVerifiedUserLabel } from "@/features/profile/lib/identity"; +import { formatVerifiedProfileLabel } from "@/features/profile/lib/identity"; import { SidebarLoadingContent, useSidebarLoadingShape, @@ -479,18 +479,13 @@ export function AppSidebar({ immediate: isSelectedDirectMessage, timeoutMs: 400, }); - const resolvedProfileDisplayName = formatVerifiedUserLabel( - profile?.displayName, - profile?.verifiedName, - profile?.verifiedNameExpiresAt, - ); const { dmChannelLabels, dmParticipantsByChannelId, dmPresenceByChannelId } = useDmSidebarMetadata({ currentPubkey, directMessages, enabled: shouldLoadDmMetadata, fallbackDisplayName, - profileDisplayName: resolvedProfileDisplayName, + profileDisplayName: formatVerifiedProfileLabel(profile), }); const sortedDirectMessages = React.useMemo( () => @@ -510,7 +505,7 @@ export function AppSidebar({ streamChannels, }); const resolvedDisplayName = - resolvedProfileDisplayName || + formatVerifiedProfileLabel(profile) || fallbackDisplayName?.trim() || "Current identity"; const isCreatingAny = diff --git a/desktop/tests/e2e/video-attachment.spec.ts b/desktop/tests/e2e/video-attachment.spec.ts index 458689a5e..0ccc74b3c 100644 --- a/desktop/tests/e2e/video-attachment.spec.ts +++ b/desktop/tests/e2e/video-attachment.spec.ts @@ -1077,7 +1077,9 @@ test("right-click menus expose distinct selectors for links, relay video, and of sha: MENU_OFF_RELAY_VIDEO_SHA, filename: "external-clip.mp4", }); - const offRelayPlayer = page.getByTestId("video-player").last(); + const offRelayPlayer = page + .getByTestId("video-player") + .filter({ has: page.locator(`video[src="${MENU_OFF_RELAY_VIDEO_URL}"]`) }); await expect(offRelayPlayer).toBeVisible(); await offRelayPlayer.click({ button: "right", force: true });