Ignore:
Timestamp:
06/26/2026 11:55:09 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
7e66e7e
Parents:
9d34855
Message:

feat(news): feed like+boost toggle in place (fetch, no reload, no banner)

/news/like and /news/boost are now single toggling routes that return JSON {on} for a
fetch request; news.ejs posts via fetch and flips the button is-on without a reload or a
success banner. No-JS falls back to a plain redirect. getTimelineReaction reads state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r9d34855 r0a75356  
    11061106  try { if (!_unmarkLike) _unmarkLike = db.prepare('UPDATE ap_timeline SET liked = 0 WHERE slug = ? AND id = ?'); _unmarkLike.run(slug, noteId); } catch { /* ignore */ }
    11071107}
     1108export function getTimelineReaction(slug, noteId) {
     1109  try { const r = db.prepare('SELECT liked, boosted FROM ap_timeline WHERE slug = ? AND id = ?').get(slug, noteId); return { liked: !!(r && r.liked), boosted: !!(r && r.boosted) }; } catch { return { liked: false, boosted: false }; }
     1110}
    11081111export function boostedCount(slug) {
    11091112  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; }
     
    13561359  listOutbox, deliverOutboxDelete,
    13571360  webfingerResolve, followActor, resolveRemoteActor, unfollowActor, listFollowing, setAutoBoost, getTimeline, sendInteraction,
    1358   autoBoostCount, boostedCount, markBoosted, unmarkBoosted, markLiked, unmarkLiked, getCirkelPosts, getCirkelMembers, selfHealTimeline,
     1361  autoBoostCount, boostedCount, markBoosted, unmarkBoosted, markLiked, unmarkLiked, getTimelineReaction, getCirkelPosts, getCirkelMembers, selfHealTimeline,
    13591362  getNotifications, listBlocks, isBlockedAny, blockTarget, unblock,
    13601363  deliverWithRetry, enqueueDelivery, processDeliveryQueue, startDeliveryWorker,
Note: See TracChangeset for help on using the changeset viewer.