Changeset 3289a64 in Klonkt for src/services/ActivityPubService.js
- Timestamp:
- 06/26/2026 11:30:21 PM (2 months ago)
- Branches:
- main
- Children:
- 3d37c67
- Parents:
- c745659
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
rc745659 r3289a64 352 352 _delLA = db.prepare('DELETE FROM ap_interactions WHERE kind = ? AND post_id = ? AND actor_uri = ?'); 353 353 _delReply = db.prepare("DELETE FROM ap_interactions WHERE kind = 'reply' AND object_uri = ?"); 354 _listI = db.prepare('SELECT id, kind, object_uri, parent_uri, actor_uri, actor_name, actor_handle, actor_url, actor_icon, content, published, created_at, acted_boost FROM ap_interactions WHERE post_id = ? ORDER BY created_at ASC');354 _listI = db.prepare('SELECT id, kind, object_uri, parent_uri, actor_uri, actor_name, actor_handle, actor_url, actor_icon, content, published, created_at, acted_boost, acted_like FROM ap_interactions WHERE post_id = ? ORDER BY created_at ASC'); 355 355 _getI = db.prepare('SELECT * FROM ap_interactions WHERE id = ?'); 356 356 _insO = db.prepare('INSERT INTO ap_outbox (id, site_slug, post_id, post_slug, in_reply_to, to_actor, to_handle, content, created_at) VALUES (?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP)'); … … 364 364 export function setInteractionBoosted(id, on) { 365 365 db.prepare('UPDATE ap_interactions SET acted_boost = ? WHERE id = ?').run(on ? 1 : 0, id); 366 } 367 export function setInteractionLiked(id, on) { 368 db.prepare('UPDATE ap_interactions SET acted_like = ? WHERE id = ?').run(on ? 1 : 0, id); 366 369 } 367 370 … … 423 426 actor_name: r.actor_name, actor_handle: r.actor_handle, actor_url: r.actor_url, 424 427 actor_icon: r.actor_icon, content: r.content, created_at: r.published || r.created_at, 425 acted_boost: !!r.acted_boost, 428 acted_boost: !!r.acted_boost, acted_like: !!r.acted_like, 426 429 children: [], 427 430 }); … … 1223 1226 const fanout = (kind === 'boost' || kind === 'unboost'); // also goes to our followers 1224 1227 let act; 1225 if (kind === 'unboost') { 1228 if (kind === 'unboost' || kind === 'unlike') { 1229 // Undo(Announce) retracts a boost; Undo(Like) un-favourites (matched on actor+object, 1230 // no record of the original activity needed — Mastodon honours both). 1231 const inner = kind === 'unboost' ? 'Announce' : 'Like'; 1226 1232 act = { 1227 1233 '@context': 'https://www.w3.org/ns/activitystreams', 1228 1234 id: `${me}#undo-${Date.now()}-${rid()}`, type: 'Undo', actor: me, 1229 to: [PUBLIC], cc: [`${me}/followers`], 1230 object: { id: `${me}#announce-${Date.now()}-${rid()}`, type: 'Announce', actor: me, object: targetNoteId }, 1235 object: { id: `${me}#${inner.toLowerCase()}-${Date.now()}-${rid()}`, type: inner, actor: me, object: targetNoteId }, 1231 1236 }; 1237 if (kind === 'unboost') { act.to = [PUBLIC]; act.cc = [`${me}/followers`]; } 1232 1238 } else { 1233 1239 const type = kind === 'boost' ? 'Announce' : 'Like'; … … 1331 1337 buildActor, buildNote, buildCreate, buildOutbox, buildFollowers, buildFeatured, 1332 1338 followerCount, deliver, fetchActor, verifyRequest, handleInbox, deliverCreate, deliverDelete, deliverUpdate, deliverActorUpdate, resyncFeaturedPins, 1333 getInteractions, getInteractionById, setInteractionBoosted, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote,1339 getInteractions, getInteractionById, setInteractionBoosted, setInteractionLiked, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote, 1334 1340 listOutbox, deliverOutboxDelete, 1335 1341 webfingerResolve, followActor, resolveRemoteActor, unfollowActor, listFollowing, setAutoBoost, getTimeline, sendInteraction,
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)