Skip to content

Commit

Permalink
Fix parent comment linking when not showing context (#2417)
Browse files Browse the repository at this point in the history
The same code is reused for the "show context" button as for the "link
to self" button. I'm not sure that's such a good idea in the long run.

There was a const `parentCommentId` that was always set even when not
having the `showContext` prop, causing the bug #2401.
  • Loading branch information
snan authored Apr 11, 2024
1 parent ddd4a98 commit b983071
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/shared/components/comment/comment-node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,14 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
? I18NextService.i18n.t("show_context")
: I18NextService.i18n.t("link");

// The context button should show the parent comment by default
const parentCommentId = getCommentParentId(cv.comment) ?? cv.comment.id;

return (
<>
<Link
className={classnames}
to={`/comment/${parentCommentId}`}
to={`/comment/${
(this.props.showContext && getCommentParentId(cv.comment)) ||
cv.comment.id
}`}
title={title}
>
<Icon icon="link" classes="icon-inline" />
Expand Down

0 comments on commit b983071

Please sign in to comment.