Skip to content

Draw one comment shield when another extension inserts beside the name - #161

Merged
macintacos merged 1 commit into
mainfrom
fix/double-comment-shield
Nov 17, 2026
Merged

macintacos merged 1 commit into
mainfrom
fix/double-comment-shield

Conversation

@macintacos

Copy link
Copy Markdown
Owner

Change Kind: bug fix

What changed

With Refined GitHub installed, every shielded comment author showed two code-owner shields. One sat after the login, and a second after the (Full Name) that Refined GitHub's show-names feature adds. Code owners and team membership had nothing to do with it.

gh-prism draws its shield right after the author's name. Show-names then inserts its (Full Name) span right after the same name, which pushes the shield one place along. When the page changed next, gh-prism's dedupe check only looked at the name's next sibling. It found the span instead of the shield, so it drew a second shield.

addAuthorShields now skips a name whose header already holds gh-prism's shield anywhere among the name's siblings. Each layout's name parent (the classic <strong>'s parent, the Overview and new Files changed TitleContainer) holds a single comment author. A new test in the comment-author describe.each puts a span after each name once the shields settle. It failed in all four layouts before the fix, with two shields per header, and passes now.

Screenshots

Taken on excessive-dev/gh-prism-codeowners-sandbox#1, which now has example comments by a code owner:

  • an issue comment;
  • a review with a body and threads on docs/ and api/;
  • a reply in the docs/ thread;
  • a review with no body and one thread on web/.

Refined GitHub's show-names skips the signed-in viewer's own comments, and every sandbox comment is mine. So the capture script replays its insertion instead: the same (Full Name) span, added after the author link (or after its <strong> in the classic layout) once gh-prism's shield is in the header. That is the order the bug needs. Shields per header, before → after:

  • Overview: 2 → 1 on all 6 headers.

    Overview: two shields before, one after

  • Classic Conversation: 2 → 1 on all 7 headers.

    Classic Conversation: two shields before, one after

  • Files changed, comments panel: 2 → 1 on all 4 headers.

    Files changed comments panel: two shields before, one after

What to test

  • With Refined GitHub's show-names on, open a pull request where someone other than you, who owns changed files, has commented. Their comment headers each show one shield, after their (Full Name). Check:
    • the Overview;
    • the classic Conversation tab;
    • the new Files changed's comments panel.
  • With Refined GitHub off, the shield still sits right after the author's name.
  • mise run test reviewer-files passes, including "keeps one shield when another extension inserts beside the name".

Refined GitHub's show-names span lands between the author's name and gh-prism's shield, so the next-sibling guard missed the shield and drew a second one.
@macintacos
macintacos merged commit dec14ff into main Nov 17, 2026
8 checks passed
@macintacos
macintacos deleted the fix/double-comment-shield branch November 17, 2026 23:01
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