Skip to content

Add permalinks for comments and replies - #246

Open
ruibaby wants to merge 6 commits into
mainfrom
feat/comment-permalinks
Open

ruibaby wants to merge 6 commits into
mainfrom
feat/comment-permalinks

Conversation

@ruibaby

@ruibaby ruibaby commented Sep 14, 2026

Copy link
Copy Markdown
Member

Add shareable links to comment and reply timestamps. Opening a link displays the selected discussion without loading the main comment list, with an option to return to all comments.

Reply links load the parent comment and target reply directly. The plugin endpoint checks visibility and parent ownership and returns sanitized display data.

Includes localized link controls, keyboard-accessible copying, theme support, and usage documentation.

Validation:

  • Frontend suite and focused browser checks passed.
  • All 209 backend tests passed.
  • TypeScript checks and production builds passed.
  • Light, dark, and mobile layouts checked in Chromium.
  • Live Halo backend integration was not verified.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-20T08:55:08.045353Z 4c332e5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e49948877

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +55 to +58
if (
subject.group !== this.group ||
subject.kind !== this.kind ||
subject.name !== this.name

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate the subject version before rendering permalink details

When widgets target two API versions with the same group, kind, and resource name, this check accepts a comment from the other version and renders it in the current widget. The normal list and comment submission both include version, so permalink detail should also consume versionContext and require subject.version === this.version to preserve the same subject boundary.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 275ca69fd9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

override render() {
return html`<div class="detail mt-5" @comment-managed=${() => this.load()} @reply-form-open=${(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore focus after management-triggered reloads

When a moderator approves, hides, or pins a comment or reply from permalink detail, the comment-managed handler discards the event's restoreFocus state and calls load(), which immediately replaces the focused item with the loading block. After the response renders a new keyed item, nothing receives focus, leaving keyboard users at the document body; preserve the management focus target or explicitly focus the refreshed detail after non-delete actions.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d0d9ad21a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

subject.kind !== this.kind ||
subject.name !== this.name
) {
this.error = msg('Comment not found or unavailable');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep nonmatching widgets in list mode

When a page contains comment widgets for multiple subjects, every instance consumes the same global permalink hash and enters detail mode. Instances whose subject does not match then stay on this error instead of rendering their own comment lists, and the finally block also scrolls each mismatched detail into view; for root-comment links, whichever request finishes last can therefore move the visitor away from the intended widget. Treat a subject mismatch as “this target belongs to another widget” without replacing or scrolling that instance.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97b356dbc0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +90 to +92
private onCommentCreated = () => {
if (this.commentTarget) this.returnToList();
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope comment-created handling to the originating widget

On pages containing multiple comment widgets, submitting the form in any widget dispatches the global halo:comment:created event, so a different widget currently showing a permalink also runs returnToList(). That unexpectedly clears the page's permalink hash and navigates away from an unrelated discussion; include the subject in the event and filter it here, or use a widget-local event.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c332e5757

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +103 to +104
history.pushState(history.state, '', url);
window.dispatchEvent(new Event('hashchange'));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Dispatch a real HashChangeEvent

When a visitor clicks “Back to comments,” pushState does not emit a native hash-change notification, and the replacement plain Event lacks the standard oldURL and newURL fields. Because this widget is embedded in host pages, any theme or router whose hashchange handler consumes those fields can fail or process an invalid URL on this navigation; construct a HashChangeEvent with both URLs, or update the widgets without broadcasting a malformed browser event.

Useful? React with 👍 / 👎.

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