Changeset 0a93c15 in Klonkt


Ignore:
Timestamp:
07/04/2026 05:44:17 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
da71f9d
Parents:
6ec0433
Message:

fix(ap): a poll keeps its cover art when federated

The real reason "Swimming Pools" (a music poll) showed a blank tile
after every earlier cover fix: applyPollToNote did delete note.image,
stripping the cover off the AS2 Question entirely — so it was never in
the federated poll, and no amount of consumer-side healing could bring
back what the origin never sent.

The comment justified it as "media + poll are mutually exclusive on
Mastodon", but that's true only of attachment (media). image is the
cover, which Mastodon ignores on any Note/Question anyway and Klonkt
reads to show the cover in feeds/the Cirkel. Keep attachment stripped,
keep image.

Verified with a new test: an embed/music poll (images suppressed → cover
in note.image) stays a Question, keeps note.image with its alt text, and
still has no attachment. Suite 46/46.

  • src/services/ActivityPubService.js — stop deleting note.image in applyPollToNote
  • test/polls.test.js — poll-keeps-cover test
  • CHANGELOG(.nl/.de).md — Unreleased entry (3 languages)

Co-Authored-By: Claude <noreply@…>

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG.de.md

    r6ec0433 r0a93c15  
    55
    66## [Unreleased]
     7
     8### Behoben
     9- **Umfragen behalten ihr Cover, wenn sie geboostet werden.** Eine Umfrage mit
     10  Musik oder Embed wurde ohne Cover föderiert, sodass eine geteilte Umfrage eine
     11  leere Kachel zeigte; das Cover reist jetzt mit.
    712
    813## [1.3.4] — 2026-07-04
  • CHANGELOG.md

    r6ec0433 r0a93c15  
    55
    66## [Unreleased]
     7
     8### Fixed
     9- **Polls keep their cover art when boosted.** A poll with music or an embed was
     10  federating without its cover, so a boosted poll showed a blank tile; the cover
     11  now travels with it.
    712
    813## [1.3.4] — 2026-07-04
  • CHANGELOG.nl.md

    r6ec0433 r0a93c15  
    55
    66## [Unreleased]
     7
     8### Opgelost
     9- **Polls behouden hun cover als ze geboost worden.** Een poll met muziek of een
     10  embed federeerde zonder cover, waardoor een geboooste poll een leeg vak toonde;
     11  de cover reist nu mee.
    712
    813## [1.3.4] — 2026-07-04
  • src/services/ActivityPubService.js

    r6ec0433 r0a93c15  
    890890  if (poll.closed) note.closed = poll.endTime ? new Date(poll.endTime).toISOString() : new Date().toISOString();
    891891  note.votersCount = voters;
    892   delete note.attachment;   // media + poll are mutually exclusive on Mastodon
    893   delete note.image;
     892  delete note.attachment;   // media ATTACHMENTS + a poll are mutually exclusive on Mastodon
     893  // Keep note.image: it's the cover, which Mastodon ignores on a Question anyway
     894  // (same as on any Note) but Klonkt reads to show the cover in feeds/the Cirkel.
     895  // Deleting it stripped the cover off every boosted poll.
    894896  return note;
    895897}
  • test/polls.test.js

    r6ec0433 r0a93c15  
    4242  assert.ok(note.endTime, 'has an endTime');
    4343  assert.ok(!('attachment' in note), 'no media on a poll (mutually exclusive on Mastodon)');
     44});
     45
     46test('a poll KEEPS its cover in note.image (feeds show it; Mastodon ignores it)', () => {
     47  // An embed/music poll suppresses image attachments (so Mastodon shows the
     48  // player/embed card) and carries the cover in note.image instead — exactly
     49  // the case that lost its cover when applyPollToNote deleted image.
     50  const withCover = {
     51    ...singlePoll, id: 'p1', slug: 'fav',
     52    content: '<p>Pick one</p> [[embed:https://www.youtube.com/watch?v=abcdefghijk]]',
     53    cover_image_url: '/media/post-images/cover.webp', cover_alt: 'Album art',
     54  };
     55  const note = AP.buildNote(BASE, site, withCover);
     56  assert.equal(note.type, 'Question', 'still a Question');
     57  assert.ok(note.image && note.image.url, 'the cover survives as note.image');
     58  assert.ok(note.image.url.endsWith('/media/post-images/cover.webp'), 'absolute cover url');
     59  assert.equal(note.image.name, 'Album art', 'alt text kept');
     60  assert.ok(!('attachment' in note), 'still no media attachment on a poll');
    4461});
    4562
Note: See TracChangeset for help on using the changeset viewer.