Changeset c745659 in Klonkt for src/routes/posts.js


Ignore:
Timestamp:
06/26/2026 11:25:14 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
3289a64
Parents:
eacd3d6
Message:

feat(fedi): comment boost is a toggle with state + coloured action icons

Inbound fediverse comments: the owner like/boost/reply controls are now coloured SVG
icons (gold star / green repeat / accent arrow), matching the News feed. Boost is a
real toggle — ap_interactions.acted_boost remembers what you boosted, the button shows
an 'on' state, and clicking again retracts it (Undo Announce). Like stays fire-and-forget
(no unlike in AS).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    reacd3d6 rc745659  
    10151015  const kind = req.body.kind === 'boost' ? 'boost' : 'like';
    10161016  if (parent && parent.post_id === post.id && parent.object_uri) {
    1017     ActivityPubService.sendInteraction(site, kind, parent.object_uri, parent.actor_uri)
    1018       .catch((e) => console.warn('[AP] reaction failed:', e.message));
     1017    if (kind === 'boost') {
     1018      // Toggle: boost an unboosted comment, or retract it (Undo Announce) if already boosted.
     1019      const on = !parent.acted_boost;
     1020      ActivityPubService.sendInteraction(site, on ? 'boost' : 'unboost', parent.object_uri, parent.actor_uri)
     1021        .catch((e) => console.warn('[AP] reaction failed:', e.message));
     1022      ActivityPubService.setInteractionBoosted(parent.id, on);
     1023    } else {
     1024      ActivityPubService.sendInteraction(site, 'like', parent.object_uri, parent.actor_uri)
     1025        .catch((e) => console.warn('[AP] reaction failed:', e.message));
     1026    }
    10191027  }
    10201028  res.redirect(`${res.locals.siteUrlBase || ''}/${post.slug}#fediverse`);
Note: See TracChangeset for help on using the changeset viewer.