Skip to content

Commit ac4aa94

Browse files
authored
Hide download action on voice notes (#7182)
## Summary - hide the native Download action on voice-note cards - preserve Download for ordinary relay-hosted audio attachments - add focused E2E coverage for both behaviors Follow-up to #6978. ## Testing - `pnpm -C desktop exec biome check src/features/messages/ui/AudioMessageAttachment.tsx tests/e2e/voice-note.spec.ts` - `pnpm -C desktop typecheck` - `pnpm -C desktop build:e2e` - `pnpm -C desktop exec playwright test tests/e2e/voice-note.spec.ts --project=smoke` (13/13) - pre-push desktop suite (5,881/5,881) Signed-off-by: kenny lopez <[email protected]>
1 parent bd73490 commit ac4aa94

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

‎desktop/src/features/messages/ui/AudioMessageAttachment.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { toast } from "sonner";
55

66
import {
77
formatVoiceNoteDuration,
8+
isVoiceNoteAttachment,
89
nextVoiceNotePlaybackRate,
910
resolveAudioAttachment,
1011
summarizeWaveform,
@@ -51,7 +52,10 @@ export function renderAudioMessageAttachment(
5152
) {
5253
const attachment = resolveAudioAttachment(entry, href, label);
5354
return attachment ? (
54-
<AudioMessageAttachment {...attachment} downloadUrl={downloadUrl} />
55+
<AudioMessageAttachment
56+
{...attachment}
57+
downloadUrl={isVoiceNoteAttachment(entry) ? undefined : downloadUrl}
58+
/>
5559
) : null;
5660
}
5761

‎desktop/tests/e2e/voice-note.spec.ts‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,39 @@ test("generic audio retains the relay-native download action", async ({
431431
});
432432
});
433433

434+
test("voice notes omit the relay-native download action", async ({ page }) => {
435+
const audioUrl = `http://localhost:3000/media/${"e".repeat(64)}.mp4`;
436+
await page.goto("/");
437+
await page.getByTestId("channel-general").click();
438+
await waitForMockLiveSubscription(page, "general");
439+
await page.evaluate(
440+
({ href }) => {
441+
const emit = window.__BUZZ_E2E_EMIT_MOCK_MESSAGE__;
442+
if (!emit) throw new Error("Mock message emitter is unavailable.");
443+
emit({
444+
channelName: "general",
445+
content: `[voice-note-123.mp4](${href})`,
446+
extraTags: [
447+
[
448+
"imeta",
449+
`url ${href}`,
450+
"m video/mp4",
451+
"duration 9.4",
452+
"filename voice-note-123.mp4",
453+
],
454+
],
455+
});
456+
},
457+
{ href: audioUrl },
458+
);
459+
460+
const card = page.getByTestId("audio-message-attachment").last();
461+
await expect(card).toBeVisible();
462+
await expect(
463+
card.getByRole("button", { name: "Download voice-note-123.mp4" }),
464+
).toHaveCount(0);
465+
});
466+
434467
test("hard-caps audio work and cancels active and queued loads on unmount", async ({
435468
page,
436469
}) => {

0 commit comments

Comments
 (0)