Changeset c010b42 in Klonkt for src/routes/posts.js
- Timestamp:
- 08/06/2026 08:46:01 AM (5 weeks ago)
- Branches:
- main
- Children:
- 0e27e54
- Parents:
- 02fb7ce
- git-author:
- Robin <roboburr@…> (08/06/2026 08:46:00 AM)
- git-committer:
- Claude (agent) <aiclaude@…> (08/06/2026 08:46:01 AM)
- File:
-
- 1 edited
-
src/routes/posts.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
r02fb7ce rc010b42 843 843 .then((note) => note && ActivityPubService.sendInteraction(site, on ? 'like' : 'unlike', note.object_uri || uri, note.actor_uri)) 844 844 .catch((e) => console.warn('[AP] remote like failed:', e.message)); 845 ActivityPubService.setMyReaction(site.slug, uri, 'like', on); 845 // Eén schrijfpad (shaer-9e9): tussentabel + afgeleide vlag. 846 ActivityPubService.setReaction(site.slug, uri, 'like', on); 846 847 } 847 848 if (req.get('X-Requested-With') === 'fetch') return res.json({ ok: true, on }); … … 862 863 const id = note.object_uri || uri; 863 864 return Promise.resolve(ActivityPubService.sendInteraction(site, on ? 'boost' : 'unboost', id, note.actor_uri)) 864 // Boost → store the post in the timeline (even if you don't follow the author) so it 865 // surfaces in the Cirkel; unboost → just clear the flag. 866 .then(() => on ? ActivityPubService.upsertBoostedNote(site.slug, note) : ActivityPubService.unmarkBoosted(site.slug, id)); 865 // De note gaat mee: een boost zet niet alleen een vlag maar trekt de 866 // post je tijdlijn in, ook als je de auteur niet volgt, zodat hij in 867 // de Cirkel verschijnt. 868 .then(() => ActivityPubService.setReaction(site.slug, uri, 'boost', on, { flagUri: id, note: on ? note : null })); 867 869 }) 868 870 .catch((e) => console.warn('[AP] remote boost failed:', e.message)); 871 // De tussentabel meteen, zodat de knop klopt voordat de resolve terug is. 869 872 ActivityPubService.setMyReaction(site.slug, uri, 'boost', on); 870 873 } … … 1279 1282 on = !ActivityPubService.getTimelineReaction(site.slug, note).liked; 1280 1283 try { await ActivityPubService.sendInteraction(site, on ? 'like' : 'unlike', note, (req.body.author || '').toString()); } catch (e) { /* ignore */ } 1281 if (on) ActivityPubService.markLiked(site.slug, note); else ActivityPubService.unmarkLiked(site.slug, note);1284 ActivityPubService.setReaction(site.slug, note, 'like', on); 1282 1285 } 1283 1286 if (req.get('X-Requested-With') === 'fetch') return res.json({ ok: true, on }); … … 1293 1296 on = !ActivityPubService.getTimelineReaction(site.slug, note).boosted; 1294 1297 try { await ActivityPubService.sendInteraction(site, on ? 'boost' : 'unboost', note, (req.body.author || '').toString()); } catch (e) { /* ignore */ } 1298 ActivityPubService.setReaction(site.slug, note, 'boost', on); // instant UI state 1295 1299 if (on) { 1296 ActivityPubService.markBoosted(site.slug, note); // instant UI state1297 1300 // Fire-and-forget: re-resolve the note so the cached row is refreshed 1298 1301 // (cover/content) — boosting again heals a stale copy from EVERY boost 1299 1302 // path, not just the interact page. 1300 1303 ActivityPubService.resolveRemoteNote(note) 1301 .then((n) => { if (n) ActivityPubService. upsertBoostedNote(site.slug, n); })1304 .then((n) => { if (n) ActivityPubService.setReaction(site.slug, note, 'boost', true, { note: n }); }) 1302 1305 .catch(() => { /* best-effort */ }); 1303 } else {1304 ActivityPubService.unmarkBoosted(site.slug, note);1305 1306 } 1306 1307 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)