Changeset 70677e96 in Klonkt for src/routes
- Timestamp:
- 07/28/2026 07:43:49 PM (6 weeks ago)
- Branches:
- main
- Children:
- 742ba7e
- Parents:
- a7bcf66
- File:
-
- 1 edited
-
src/routes/guardian.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/guardian.js
ra7bcf66 r70677e96 41 41 'pending', 'active', 'retract', 'release', 'release_confirm', 'open', 'push_unavailable', 42 42 'embeds_on', 'embeds_off', 'embeds_propose', 'embeds_waiting', 43 'accept', 'reject', 'complete', 'awaiting_others', 'coguard']; 43 'accept', 'reject', 'complete', 'awaiting_others', 'coguard', 44 // The per-ward panel: everything about one child in one place. 45 'settings_title', 'panel_open', 'panel_close', 'panel_help', 'panel_help_empty', 46 'panel_follow', 'panel_follow_empty', 'panel_posts', 'panel_posts_empty', 47 'panel_actions', 'badge_help', 'badge_follow', 'badge_follow_one', 'help_empty']; 44 48 const s = Object.fromEntries(keys.map((k) => [k, i18nT(L, `guardian.${k}`)])); 45 49 s.wave = i18nT(L, 'guardian.wave'); … … 139 143 id: p.id, 140 144 author: p.author_handle || p.author_name || p.author_uri, 145 authorUri: p.author_uri, // the grouping key: which child's panel this belongs in 141 146 authorName: p.author_name, 142 147 authorIcon: p.author_icon, … … 157 162 const base = (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''); 158 163 return Guardianship.listWards(site.slug) 159 .map((w) => (w.other_uri.startsWith(base) ? w.other_uri.split('/').pop(): null))164 .map((w) => (w.other_uri.startsWith(base) ? { slug: w.other_uri.split('/').pop(), uri: w.other_uri } : null)) 160 165 .filter(Boolean); 161 166 } … … 166 171 const items = []; 167 172 const host = (() => { try { return new URL(process.env.PUBLIC_BASE_URL || '').host; } catch { return ''; } })(); 173 // wardUri is the grouping key for the per-ward panel: the handle is for 174 // reading, the URI is what identifies the child across both cases below. 168 175 // Local wards (guardian co-located): read the pending follows directly. 169 for (const w ardSlugof wardSlugsOf(site)) {170 for (const f of Guardianship.follows.listForWard(w ardSlug)) {171 items.push({ id: f.id, ward: `@${w ardSlug}@${host}`, follower: f.follower_handle || f.follower_name || f.follower_uri, followerIcon: f.follower_icon, remote: false, created: f.created_at });176 for (const w of wardSlugsOf(site)) { 177 for (const f of Guardianship.follows.listForWard(w.slug)) { 178 items.push({ id: f.id, ward: `@${w.slug}@${host}`, wardUri: w.uri, follower: f.follower_handle || f.follower_name || f.follower_uri, followerIcon: f.follower_icon, remote: false, created: f.created_at }); 172 179 } 173 180 } … … 175 182 for (const rev of Guardianship.follows.listReviews(site.slug)) { 176 183 const wardName = (() => { try { const u = new URL(rev.ward_uri); return `@${u.pathname.split('/').pop()}@${u.host}`; } catch { return rev.ward_uri; } })(); 177 items.push({ id: rev.id, ward: wardName, follower: rev.follower_handle || rev.follower_uri, followerIcon: rev.follower_icon, remote: true, created: rev.created_at });184 items.push({ id: rev.id, ward: wardName, wardUri: rev.ward_uri, follower: rev.follower_handle || rev.follower_uri, followerIcon: rev.follower_icon, remote: true, created: rev.created_at }); 178 185 } 179 186 res.json({ items });
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)