Skip to content

feat: Maintainer badge and configurable attribution line - #47

Merged
Robbertvermeulen merged 1 commit into
mainfrom
feat/maintainer-badge-attribution
Sep 21, 2026
Merged

Robbertvermeulen merged 1 commit into
mainfrom
feat/maintainer-badge-attribution

Conversation

@Robbertvermeulen

Copy link
Copy Markdown
Contributor

Renders a unified "Maintainer" badge next to the author wherever one renders (topic rows, detail header, post-author line, comments) driven by the hub's author_role field (defaulting to community against older hubs), and adds an optional Config::attribution string rendered as one quiet line under the page header (host plugin supplies the sentence; plain-text escaped).

Tests: JS 167/167, PHP 223/223, phpcs + phpstan clean; bundle rebuilt and committed.

🤖 Generated with Claude Code

New branch off main: badge label "Maintainer" and header attribution line,
per Robbert's decisions.

1. Maintainer badge. The hub is adding author_role: "maintainer"|"community"
   to public case responses (comments already carry it). New shared
   assets/src/badges.jsx MaintainerBadge renders a single, consistent
   "Maintainer" badge (rt-badge rt-b-maintainer — a solid accent fill,
   visually distinct from the light-tint type badges) next to the author
   handle in: TopicRow (shared by every list — all/participating/roadmap/
   started), TopicDetail's header meta row and its own post-author line, and
   CommentRow. Comments previously rendered "Maintainer" via a generic
   rt-role-badge shared with the "{agent} · Assistant" label — unified the
   maintainer case onto the new component/class instead of adding a second
   look; the assistant badge is untouched. assets/src/topics.js's
   mapCaseToTopic now maps author_role onto authorRole, defaulting to
   'community' when the hub omits it so the UI keeps working against an
   older hub. Badge spacing: rt-b-maintainer carries its own margin-left for
   the non-flex contexts (rt-cm-who, rt-post-who, matching their existing
   6px-per-child convention); rt-cmeta's flex gap already spaces it, so that
   context zeroes the margin back out.
2. Attribution line. New Config::$attribution (?string, default null),
   passed through Page::enqueue()'s boot payload like the other strings. The
   SDK carries no hardcoded vendor text — assets/src/community-app.jsx
   renders it as one line directly under the page header
   (`<p class="rt-sub rt-attribution">`, reusing the existing muted/small
   header typography) only when non-empty; Preact's default text-child
   escaping means no unsafe HTML can land in the DOM.

Tests: PageTest (attribution passthrough, present/absent) and ConfigTest
(default null, override) following the existing beta/enableChat pattern;
badges.test.mjs, plus maintainer-vs-community render assertions in
topic-list.test.mjs, topic-detail.test.mjs (header + post-author line),
topics.test.mjs (authorRole default/passthrough, resolveCommentRole's direct
author_role: 'maintainer' case), config.test.mjs, and community-app.test.mjs
(present/absent/escaped). CommentRow's maintainer branch itself isn't
exercised through a populated TopicDetail render — comments never populate
in this SSR-only test harness (no window.fetch, and useEffect doesn't run) —
so its correctness rests on the already-tested MaintainerBadge output plus
resolveCommentRole/mapCommentToView's role derivation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Robbertvermeulen
Robbertvermeulen merged commit 5a02b6e into main Sep 21, 2026
2 checks passed
@Robbertvermeulen
Robbertvermeulen deleted the feat/maintainer-badge-attribution branch September 21, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant