1
0
mirror of https://github.com/flarum/core.git synced 2025-08-17 22:01:44 +02:00

[1.x] [extensibility] refactor(core, flags): improve & use extensibility of CommentPost & Post (#4047)

* refactor(core): improve extensibility of `CommentPost`

* refactor(core): rename method to more appropriate name

* refactor(core): further improve extensibility of `CommentPost`

* refactor(core): improve extensibility of `Post`

* refactor(flags): use new extensibility for flagged posts
This commit is contained in:
Davide Iadeluca
2024-10-02 08:47:05 +02:00
committed by GitHub
parent 256c1846b7
commit d4fe5f5a7a
3 changed files with 70 additions and 35 deletions

View File

@@ -75,7 +75,7 @@ export default function () {
return items;
};
extend(Post.prototype, 'content', function (vdom) {
extend(Post.prototype, 'viewItems', function (items) {
const post = this.attrs.post;
const flags = post.flags();
@@ -83,7 +83,8 @@ export default function () {
if (post.isHidden()) this.revealContent = true;
vdom.unshift(
items.add(
'flagged',
<div className="Post-flagged">
<div className="Post-flagged-flags">
{flags.map((flag) => (
@@ -91,7 +92,8 @@ export default function () {
))}
</div>
<div className="Post-flagged-actions">{this.flagActionItems().toArray()}</div>
</div>
</div>,
110
);
});