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

feat(fedi): interact page like/boost are 2 icon+label toggle buttons

Replace the '★ Like this post' / '🔁 Boost this post' buttons with two pill buttons
(gold star + Like, green repeat + Boost) that are real toggles. New ap_my_reactions
table tracks your like/boost state on a REMOTE post; clicking again retracts (Undo
Like / Undo Announce). The like/boost POST now redirects back to the interact page so
the state shows in place (no more separate confirmation screen).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r3289a64 r3d37c67  
    367367export function setInteractionLiked(id, on) {
    368368  db.prepare('UPDATE ap_interactions SET acted_like = ? WHERE id = ?').run(on ? 1 : 0, id);
     369}
     370// Your like/boost state on a REMOTE post (interact page toggles).
     371export function setMyReaction(slug, uri, kind, on) {
     372  if (on) db.prepare('INSERT OR IGNORE INTO ap_my_reactions (site_slug, target_uri, kind) VALUES (?,?,?)').run(slug, uri, kind);
     373  else db.prepare('DELETE FROM ap_my_reactions WHERE site_slug = ? AND target_uri = ? AND kind = ?').run(slug, uri, kind);
     374}
     375export function getMyReactions(slug, uri) {
     376  const rows = (slug && uri) ? db.prepare('SELECT kind FROM ap_my_reactions WHERE site_slug = ? AND target_uri = ?').all(slug, uri) : [];
     377  return { liked: rows.some((r) => r.kind === 'like'), boosted: rows.some((r) => r.kind === 'boost') };
    369378}
    370379
     
    13371346  buildActor, buildNote, buildCreate, buildOutbox, buildFollowers, buildFeatured,
    13381347  followerCount, deliver, fetchActor, verifyRequest, handleInbox, deliverCreate, deliverDelete, deliverUpdate, deliverActorUpdate, resyncFeaturedPins,
    1339   getInteractions, getInteractionById, setInteractionBoosted, setInteractionLiked, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote,
     1348  getInteractions, getInteractionById, setInteractionBoosted, setInteractionLiked, setMyReaction, getMyReactions, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote,
    13401349  listOutbox, deliverOutboxDelete,
    13411350  webfingerResolve, followActor, resolveRemoteActor, unfollowActor, listFollowing, setAutoBoost, getTimeline, sendInteraction,
Note: See TracChangeset for help on using the changeset viewer.