Changeset cc24fa1 in Klonkt


Ignore:
Timestamp:
06/24/2026 01:11:01 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
7d932ce
Parents:
41a7637
Message:

fix(activitypub): dedup guard on outbound replies (prevent double-send)

Skip delivery when an identical reply (same site, in_reply_to, content) already
exists — guards against the multi-click duplicates from the old slow Send.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r41a7637 rcc24fa1  
    455455    ? `<a href="${escHtml(parent.actor_url || parent.actor_uri)}" class="u-url mention">${escHtml(handle)}</a> ` : '';
    456456  const content = `<p>${mention}${body}</p>`;
     457  // Dedup: skip if the exact same reply was already sent (double-submit guard).
     458  const dup = db.prepare('SELECT 1 FROM ap_outbox WHERE site_slug = ? AND IFNULL(in_reply_to, \'\') = ? AND content = ? LIMIT 1')
     459    .get(site.slug, parent.object_uri || '', content);
     460  if (dup) { console.log('[AP] outreply skipped (duplicate)'); return { duplicate: true, delivered: 0 }; }
    457461  const id = crypto.randomUUID();
    458462  iStmts().insO.run(id, site.slug, postId, postSlug || null, parent.object_uri || null, parent.actor_uri || null, handle, content);
Note: See TracChangeset for help on using the changeset viewer.