Changeset 3289a64 in Klonkt for src/routes/posts.js


Ignore:
Timestamp:
06/26/2026 11:30:21 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
3d37c67
Parents:
c745659
Message:

feat(fedi): comment like is a toggle too (Undo Like / un-favourite)

Symmetric to boost: ap_interactions.acted_like remembers a liked comment, the star
shows an 'on' state, and clicking again retracts it via Undo(Like) (Mastodon honours it).
sendInteraction gains an 'unlike' branch (author-only, no fanout).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    rc745659 r3289a64  
    10221022      ActivityPubService.setInteractionBoosted(parent.id, on);
    10231023    } else {
    1024       ActivityPubService.sendInteraction(site, 'like', parent.object_uri, parent.actor_uri)
     1024      // Toggle: like an unliked comment, or un-favourite (Undo Like) if already liked.
     1025      const on = !parent.acted_like;
     1026      ActivityPubService.sendInteraction(site, on ? 'like' : 'unlike', parent.object_uri, parent.actor_uri)
    10251027        .catch((e) => console.warn('[AP] reaction failed:', e.message));
     1028      ActivityPubService.setInteractionLiked(parent.id, on);
    10261029    }
    10271030  }
Note: See TracChangeset for help on using the changeset viewer.