Changeset 7cea873 in Klonkt
- Timestamp:
- 06/27/2026 11:56:24 AM (2 months ago)
- Branches:
- main
- Children:
- bddbfe0
- Parents:
- 6bc2ca7e
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
r6bc2ca7e r7cea873 228 228 // shift+enter uses <br> and has no \n → this is a no-op there). 229 229 body = body.replace(/\r?\n/g, '<br>'); 230 body = linkHashtags(base, body); // link inline #hashtags in the post body too 230 231 const seen = new Set(); 231 232 const attachment = urls.filter(Boolean) … … 244 245 to: post.fan_only ? [`${aId}/followers`] : [PUBLIC], 245 246 cc: post.fan_only ? [] : [`${aId}/followers`], 246 tag: Array.isArray(post.tags) ? post.tags.map((t) => ({ type: 'Hashtag', name: '#' + String(t).replace(/\s+/g, '') })) : [],247 tag: buildHashtagList(base, post.tags, body), 247 248 replies: `${id}/replies`, 248 249 // NSFW → Mastodon-style content warning: sensitive (blurs media) + a summary/spoiler … … 914 915 } 915 916 917 // Merge a post's tags field + the #hashtags linked inline in its body into one deduped 918 // Hashtag tag list (with hrefs to our /tag page). 919 function buildHashtagList(base, tagsField, content) { 920 const out = [], seen = new Set(); 921 for (const t of (Array.isArray(tagsField) ? tagsField : [])) { 922 const name = String(t).replace(/\s+/g, ''); if (!name) continue; 923 const k = name.toLowerCase(); if (seen.has(k)) continue; seen.add(k); 924 out.push({ type: 'Hashtag', href: `${base}/tag/${encodeURIComponent(k)}`, name: '#' + name }); 925 } 926 for (const h of hashtagTags(base, content)) { 927 const k = h.name.slice(1).toLowerCase(); if (seen.has(k)) continue; seen.add(k); 928 out.push(h); 929 } 930 return out; 931 } 932 916 933 export function buildReplyNote(base, site, row) { 917 934 const me = actorId(base, site.slug);
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)