Changeset de89079 in Klonkt
- Timestamp:
- 07/26/2026 10:56:43 AM (6 weeks ago)
- Branches:
- main
- Children:
- c628dcd4
- Parents:
- 42e7616
- Files:
-
- 1 added
- 2 edited
-
src/routes/activitypub.js (modified) (1 diff)
-
src/services/ActivityPubService.js (modified) (4 diffs)
-
test/c2s-reply-visibility.test.js (added)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r42e7616 rde89079 191 191 emojis: (() => { try { return t.reblog_emoji_json ? JSON.parse(t.reblog_emoji_json) : undefined; } catch { return undefined; } })(), 192 192 } : undefined, 193 // Whether THIS account already liked/boosted the note, so the app's 194 // detail-view buttons show the current state (and can toggle/undo). 195 'shaer:liked': !!t.liked, 196 'shaer:boosted': !!t.boosted, 193 197 }, 194 198 })); -
src/services/ActivityPubService.js
r42e7616 rde89079 278 278 ? (JSON.parse(post.to_actors || '[]')) 279 279 : (post.to_actor ? [post.to_actor] : [PUBLIC]), 280 cc: post.visibility === 'direct' ? [] : [PUBLIC, `${meR}/followers`], 280 // Followers-only reply ('friends', shaer detail-view Reply): the parent 281 // author (in `to`) + our followers, but NO Public — it does not federate 282 // into open discovery. Default reply stays quiet-public (Public in cc). 283 cc: post.visibility === 'direct' ? [] 284 : post.visibility === 'friends' ? [`${meR}/followers`] 285 : [PUBLIC, `${meR}/followers`], 281 286 // FEP-633c 5.2.1: a ward's call for help. Only ever on direct notes. 282 287 ...Guardianship.helpRequestProps(post), … … 2145 2150 const parent = await resolveRemoteNote(c2sIdOf(object.inReplyTo)).catch(() => null); 2146 2151 if (!parent) return { status: 502, error: 'cannot_resolve_inReplyTo' }; 2147 const r = await deliverReply(site, { postId: parent.localPostId || '', postSlug: null, parent, text: plain }); 2152 // Honour the client's visibility for the reply: 'friends' (followers- 2153 // only, the Shaer detail-view Reply) drops Public; anything else stays 2154 // quiet-public. 'direct' was already handled above. 2155 const r = await deliverReply(site, { postId: parent.localPostId || '', postSlug: null, parent, text: plain, visibility: c2sVisibility(object) }); 2148 2156 if (!r || !r.id) return { status: 502, error: 'reply_failed' }; 2149 2157 return { status: 201, id: r.id, url: `${base}/ap/notes/${r.id}` }; … … 2257 2265 // Send a reply FROM this site to a remote actor (in reply to their inbound reply). 2258 2266 // `parent` = an ap_interactions row (actor_uri, actor_url, actor_handle, object_uri). 2259 export async function deliverReply(site, { postId, postSlug, parent, text, html, language, attachments, mentions }) {2267 export async function deliverReply(site, { postId, postSlug, parent, text, html, language, attachments, mentions, visibility }) { 2260 2268 const base = (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''); 2261 2269 // Rich replies: `html` is the reply editor's HTML (sanitized here); `text` is … … 2328 2336 const id = crypto.randomUUID(); 2329 2337 iStmts().insO.run(id, site.slug, postId, postSlug || null, parent.object_uri || null, toActorUri, toHandle, content, replyLang, mediaJson); 2338 // Followers-only reply (shaer detail-view): mark the row so buildNote drops 2339 // Public from cc. Default (undefined/'public'/'quiet') stays quiet-public. 2340 if (visibility === 'friends') { try { db.prepare('UPDATE ap_outbox SET visibility = ? WHERE id = ?').run('friends', id); } catch { /* ignore */ } } 2330 2341 const row = iStmts().getO.get(id); 2331 2342 const note = buildReplyNote(base, site, row);
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)