mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 13:51:13 +00:00
Fix parent comment linking when not showing context (#2417)
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.
This commit is contained in:
parent
ddd4a98fd7
commit
b983071e79
1 changed files with 4 additions and 4 deletions
|
@ -501,14 +501,14 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
? I18NextService.i18n.t("show_context")
|
? I18NextService.i18n.t("show_context")
|
||||||
: I18NextService.i18n.t("link");
|
: I18NextService.i18n.t("link");
|
||||||
|
|
||||||
// The context button should show the parent comment by default
|
|
||||||
const parentCommentId = getCommentParentId(cv.comment) ?? cv.comment.id;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Link
|
<Link
|
||||||
className={classnames}
|
className={classnames}
|
||||||
to={`/comment/${parentCommentId}`}
|
to={`/comment/${
|
||||||
|
(this.props.showContext && getCommentParentId(cv.comment)) ||
|
||||||
|
cv.comment.id
|
||||||
|
}`}
|
||||||
title={title}
|
title={title}
|
||||||
>
|
>
|
||||||
<Icon icon="link" classes="icon-inline" />
|
<Icon icon="link" classes="icon-inline" />
|
||||||
|
|
Loading…
Reference in a new issue