Changeset 731e431 in Klonkt


Ignore:
Timestamp:
07/01/2026 07:48:48 AM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
0403187
Parents:
55a73f0
Message:

fix(fediverse): backfillFromOutbox also ingests polls (Question) with poll_json

The outbox catch-up skipped Question objects and never set poll_json, so an
existing poll (posted before you followed, or before poll support shipped)
never appeared even after a re-fetch. Now a Question is accepted like a
Note/Article and its parsed poll is stored (COALESCE preserves an existing vote).

  • src/services/ActivityPubService.js — backfillFromOutbox: allow Question + set poll_json

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r55a73f0 r731e431  
    16791679      const o = (it && typeof it.object === 'object' && it.object) ? it.object : it;
    16801680      if (!o || !o.id) continue;
    1681       if (o.type && o.type !== 'Note' && o.type !== 'Article') continue; // skip boosts/other
     1681      if (o.type && o.type !== 'Note' && o.type !== 'Article' && o.type !== 'Question') continue; // skip boosts/other
    16821682      if (o.inReplyTo) continue;                                          // top-level only
    16831683      const auth = actorUriOf(o.attributedTo);
    16841684      if (auth && auth !== actorUri) continue;                            // their OWN posts only
    16851685      const html = HtmlSanitizerService.sanitize(o.content || '');
     1686      const poll = parsePoll(o); // a Question (poll) → carry its options/counts on backfill too
    16861687      try {
    16871688        const r = tlStmts().ins.run(o.id, slug, actorUri, ai.name, ai.handle, ai.icon, ai.url, html, o.url || null, o.published || null, mediaFromNote(o), o.sensitive ? 1 : 0, o.summary || null);
    16881689        if (r && r.changes > 0) added++;
     1690        // Set poll_json if this is a poll and we don't already have it (COALESCE preserves a vote).
     1691        if (poll) { try { db.prepare('UPDATE ap_timeline SET poll_json = COALESCE(poll_json, ?) WHERE id = ? AND slug = ?').run(JSON.stringify(poll), o.id, slug); } catch { /* ignore */ } }
    16891692      } catch { /* ignore */ }
    16901693    }
Note: See TracChangeset for help on using the changeset viewer.