Ignore:
Timestamp:
06/26/2026 11:50:14 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
0a75356
Parents:
c7ecaf9
Message:

fix(news): feed like is a toggle too (like/unlike), like boost

The feed star was fire-and-forget with no state. Now ap_timeline.liked remembers it,
the star shows an 'on' state, and a second click retracts via /news/unlike (Undo Like)
— mirroring the existing boost/unboost toggle. markLiked/unmarkLiked added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    rc7ecaf9 r9d34855  
    10991099  try { if (!_unmarkBoost) _unmarkBoost = db.prepare('UPDATE ap_timeline SET boosted = 0 WHERE slug = ? AND id = ?'); _unmarkBoost.run(slug, noteId); } catch { /* ignore */ }
    11001100}
     1101let _markLike, _unmarkLike;
     1102export function markLiked(slug, noteId) {
     1103  try { if (!_markLike) _markLike = db.prepare('UPDATE ap_timeline SET liked = 1 WHERE slug = ? AND id = ?'); _markLike.run(slug, noteId); } catch { /* ignore */ }
     1104}
     1105export function unmarkLiked(slug, noteId) {
     1106  try { if (!_unmarkLike) _unmarkLike = db.prepare('UPDATE ap_timeline SET liked = 0 WHERE slug = ? AND id = ?'); _unmarkLike.run(slug, noteId); } catch { /* ignore */ }
     1107}
    11011108export function boostedCount(slug) {
    11021109  try { if (!_boostedCount) _boostedCount = db.prepare('SELECT COUNT(*) AS n FROM ap_timeline WHERE slug = ? AND boosted = 1'); return _boostedCount.get(slug).n; } catch { return 0; }
     
    13491356  listOutbox, deliverOutboxDelete,
    13501357  webfingerResolve, followActor, resolveRemoteActor, unfollowActor, listFollowing, setAutoBoost, getTimeline, sendInteraction,
    1351   autoBoostCount, boostedCount, markBoosted, unmarkBoosted, getCirkelPosts, getCirkelMembers, selfHealTimeline,
     1358  autoBoostCount, boostedCount, markBoosted, unmarkBoosted, markLiked, unmarkLiked, getCirkelPosts, getCirkelMembers, selfHealTimeline,
    13521359  getNotifications, listBlocks, isBlockedAny, blockTarget, unblock,
    13531360  deliverWithRetry, enqueueDelivery, processDeliveryQueue, startDeliveryWorker,
Note: See TracChangeset for help on using the changeset viewer.