Changeset 5045c30 in Klonkt for src/services


Ignore:
Timestamp:
06/26/2026 12:00:18 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
3384e95
Parents:
484adf8
Message:

feat(cirkel): boosted posts also appear in the Cirkel (mixed by date, deduped)

Option B: when you boost (🔁) a timeline post it's marked ap_timeline.boosted and
shows in the Cirkel alongside the featured accounts' posts, sorted by date. One row
per note → a post that's both featured and boosted appears once (no double). The
Cirkel/tab now also shows when you only have boosted posts (no featured accounts).
No fediverse traffic — the boost itself is the existing user action; this only marks
it locally.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r484adf8 r5045c30  
    10561056export function getCirkelPosts(slug, limit) {
    10571057  try {
     1058    // Cirkel = posts from featured (auto_boost) accounts + posts you boosted
     1059    // (t.boosted), mixed by date. One row per note in ap_timeline → no duplicates.
    10581060    if (!_cirkelPosts) _cirkelPosts = db.prepare(`
    10591061      SELECT t.id, t.author_uri, t.author_name, t.author_handle, t.author_icon, t.author_url,
    10601062             t.content, t.url, t.published, t.media_json
    10611063      FROM ap_timeline t
    1062       JOIN ap_following f ON f.slug = t.slug AND f.actor_uri = t.author_uri AND f.auto_boost = 1
    1063       WHERE t.slug = ?
     1064      LEFT JOIN ap_following f ON f.slug = t.slug AND f.actor_uri = t.author_uri
     1065      WHERE t.slug = ? AND (f.auto_boost = 1 OR t.boosted = 1)
    10641066      ORDER BY COALESCE(t.published, t.created_at) DESC, t.rowid DESC
    10651067      LIMIT ?`);
     
    10691071export function getCirkelMembers(slug) {
    10701072  try { if (!_cirkelMembers) _cirkelMembers = db.prepare('SELECT name, url, icon FROM ap_following WHERE slug = ? AND auto_boost = 1 ORDER BY name'); return _cirkelMembers.all(slug); } catch { return []; }
     1073}
     1074// Mark a timeline post as boosted so it shows in the Cirkel (mixed by date).
     1075let _markBoost, _boostedCount;
     1076export function markBoosted(slug, noteId) {
     1077  try { if (!_markBoost) _markBoost = db.prepare('UPDATE ap_timeline SET boosted = 1 WHERE slug = ? AND id = ?'); _markBoost.run(slug, noteId); } catch { /* ignore */ }
     1078}
     1079export function boostedCount(slug) {
     1080  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; }
    10711081}
    10721082
     
    13461356  listOutbox, deliverOutboxDelete,
    13471357  webfingerResolve, followActor, resolveRemoteActor, unfollowActor, listFollowing, setAutoBoost, getTimeline, sendInteraction,
    1348   autoBoostCount, getCirkelPosts, getCirkelMembers, autoMigrateCircles, selfHealTimeline, boostLatestN,
     1358  autoBoostCount, boostedCount, markBoosted, getCirkelPosts, getCirkelMembers, autoMigrateCircles, selfHealTimeline, boostLatestN,
    13491359  getNotifications, listBlocks, isBlockedAny, blockTarget, unblock,
    13501360  deliverWithRetry, enqueueDelivery, processDeliveryQueue, startDeliveryWorker,
Note: See TracChangeset for help on using the changeset viewer.