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/services/ActivityPubService.js

    reacd3d6 rc745659  
    352352    _delLA = db.prepare('DELETE FROM ap_interactions WHERE kind = ? AND post_id = ? AND actor_uri = ?');
    353353    _delReply = db.prepare("DELETE FROM ap_interactions WHERE kind = 'reply' AND object_uri = ?");
    354     _listI = db.prepare('SELECT id, kind, object_uri, parent_uri, actor_uri, actor_name, actor_handle, actor_url, actor_icon, content, published, created_at FROM ap_interactions WHERE post_id = ? ORDER BY created_at ASC');
     354    _listI = db.prepare('SELECT id, kind, object_uri, parent_uri, actor_uri, actor_name, actor_handle, actor_url, actor_icon, content, published, created_at, acted_boost FROM ap_interactions WHERE post_id = ? ORDER BY created_at ASC');
    355355    _getI = db.prepare('SELECT * FROM ap_interactions WHERE id = ?');
    356356    _insO = db.prepare('INSERT INTO ap_outbox (id, site_slug, post_id, post_slug, in_reply_to, to_actor, to_handle, content, created_at) VALUES (?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP)');
     
    362362
    363363export function getInteractionById(id) { return iStmts().getI.get(id); }
     364export function setInteractionBoosted(id, on) {
     365  db.prepare('UPDATE ap_interactions SET acted_boost = ? WHERE id = ?').run(on ? 1 : 0, id);
     366}
    364367
    365368const localPostExists = (id) => { try { return !!db.prepare('SELECT 1 FROM posts WHERE id = ?').get(id); } catch { return false; } };
     
    420423      actor_name: r.actor_name, actor_handle: r.actor_handle, actor_url: r.actor_url,
    421424      actor_icon: r.actor_icon, content: r.content, created_at: r.published || r.created_at,
     425      acted_boost: !!r.acted_boost,
    422426      children: [],
    423427    });
     
    13271331  buildActor, buildNote, buildCreate, buildOutbox, buildFollowers, buildFeatured,
    13281332  followerCount, deliver, fetchActor, verifyRequest, handleInbox, deliverCreate, deliverDelete, deliverUpdate, deliverActorUpdate, resyncFeaturedPins,
    1329   getInteractions, getInteractionById, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote,
     1333  getInteractions, getInteractionById, setInteractionBoosted, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote,
    13301334  listOutbox, deliverOutboxDelete,
    13311335  webfingerResolve, followActor, resolveRemoteActor, unfollowActor, listFollowing, setAutoBoost, getTimeline, sendInteraction,
Note: See TracChangeset for help on using the changeset viewer.