Changeset 462a931 in Klonkt for src/routes


Ignore:
Timestamp:
06/30/2026 01:31:49 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
8b700ad
Parents:
d5aa7c8
Message:

feat(circle): filter the Circle feed by member (clickable chips + Following "Show" link)

The member chips on the Circle page are now clickable filters: clicking one shows only that
account's posts, with an "Everyone" chip to clear and an active highlight. The Following page
gets a "Show" link per featured account that lands on the filtered Circle view. So Featured =
"include in my Circle", and Show lets you view just that one person here.

  • src/services/ActivityPubService.js — getCirkelPosts(slug, limit, actorUri) filter; members expose actor_uri
  • src/routes/circle.js — honour ?actor=<uri> (validated against the member list) + active flags
  • src/views/pages/circle-feed.ejs — chips + modal as filter links + Everyone + active state
  • src/views/pages/following.ejs — Show link for featured accounts
  • src/services/i18n.js — cfeed.all, tl.show (nl/en/de)

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/circle.js

    rd5aa7c8 r462a931  
    3131  if (!site || !apEnabled() || (ActivityPubService.autoBoostCount(site.slug) === 0 && ActivityPubService.boostedCount(site.slug) === 0)) return next();
    3232
    33   const posts = ActivityPubService.getCirkelPosts(site.slug, 80).map((r) => {
     33  const members = ActivityPubService.getCirkelMembers(site.slug);
     34  // Optional ?actor=<uri> → show only that member's posts. Only honour a uri that is
     35  // actually a featured member (so it can't be used to probe arbitrary timeline rows).
     36  const reqActor = safeUrl(req.query.actor);
     37  const activeMember = reqActor ? members.find((m) => m.actor_uri === reqActor) : null;
     38  const activeActor = activeMember ? activeMember.actor_uri : null;
     39
     40  const posts = ActivityPubService.getCirkelPosts(site.slug, 80, activeActor).map((r) => {
    3441    const text = htmlToText(r.content);
    3542    // Show ONLY the title (the bold first line a Klonkt note carries), not the whole
     
    6168  });
    6269
    63   const sites = ActivityPubService.getCirkelMembers(site.slug)
    64     .map((s) => ({ name: s.name || 'Onbekend', url: safeUrl(s.url), avatar: safeUrl(s.icon) }));
     70  const sites = members.map((s) => ({
     71    name: s.name || 'Onbekend', url: safeUrl(s.url), avatar: safeUrl(s.icon),
     72    actor_uri: s.actor_uri, active: !!(activeActor && s.actor_uri === activeActor),
     73  }));
    6574
    66   renderPage(req, res, 'pages/circle-feed', { pageTitle: 'Cirkel', bodyClass: 'on-cirkel', posts, sites });
     75  renderPage(req, res, 'pages/circle-feed', {
     76    pageTitle: 'Cirkel', bodyClass: 'on-cirkel', posts, sites,
     77    activeActor, activeName: activeMember ? (activeMember.name || '') : '',
     78  });
    6779});
    6880
Note: See TracChangeset for help on using the changeset viewer.