Skip to content

Commit

Permalink
feat: append signature directly after post-body (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland authored Dec 18, 2023
1 parent b9366eb commit 54a6b54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
],
"require": {
"flarum/core": "^1.2.0",
"flarum/core": "^1.7.0",
"symfony/dom-crawler": "^5.0 || ^6.0.2",
"symfony/css-selector": "^5.0 || ^6.0.2"
},
Expand Down
12 changes: 7 additions & 5 deletions js/src/forum/extendCommentPost.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import app from 'flarum/forum/app';
import { extend } from 'flarum/common/extend';
import type Mithril from 'mithril';
import CommentPost from 'flarum/forum/components/CommentPost';
import Signature from './components/Signature';

export default function extendCommentPost() {
extend(CommentPost.prototype, 'view', function (vnode: Mithril.Vnode) {
if (this.attrs.post.user()) {
extend(CommentPost.prototype, 'content', function (content) {
if (this.attrs.post.user?.()) {
if (this.attrs.post.user().signature()) {
vnode.children.push(<Signature user={this.attrs.post.user()} readonly={true} />);
content.push(
<div className="Post-signature">
<Signature user={this.attrs.post.user()} readonly={true} />
</div>
);
}
}
});
Expand Down

0 comments on commit 54a6b54

Please sign in to comment.