Add federated post and comment links. Fixes #569 (#575)

This commit is contained in:
Dessalines 2022-02-14 13:49:57 -05:00 committed by GitHub
parent 7d578d2abc
commit e13ab2ee46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 94 additions and 7 deletions

View file

@ -1,3 +1,4 @@
import classNames from "classnames";
import { Component, linkEvent } from "inferno";
import { Link } from "inferno-router";
import {
@ -849,14 +850,30 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
linkBtn(small = false) {
let cv = this.props.node.comment_view;
let classnames = classNames("btn btn-link btn-animate text-muted", {
"btn-sm": small,
});
let title = this.props.showContext
? i18n.t("show_context")
: i18n.t("link");
return (
<Link
className={`btn ${small && "btn-sm"} btn-link btn-animate text-muted`}
to={`/post/${cv.post.id}/comment/${cv.comment.id}`}
title={this.props.showContext ? i18n.t("show_context") : i18n.t("link")}
>
<Icon icon="link" classes="icon-inline" />
</Link>
<>
<Link
className={classnames}
to={`/post/${cv.post.id}/comment/${cv.comment.id}`}
title={title}
>
<Icon icon="link" classes="icon-inline" />
</Link>
{/* TODO comment ap_ids are currently broken anyway, so use post.ap_id, and wait until comment tree / endpoint refactor */}
{!cv.comment.local && (
<a className={classnames} title={title} href={cv.post.ap_id}>
<Icon icon="fedilink" classes="icon-inline" />
</a>
)}
</>
);
}