Skip to content

Commit

Permalink
refactor(flags): use new extensibility for flagged posts
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideIadeluca committed Sep 18, 2024
1 parent 2a70234 commit af23ce8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions extensions/flags/js/src/forum/addFlagsToPosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,25 @@ 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();

if (!flags.length) return;

if (post.isHidden()) this.revealContent = true;

vdom.unshift(
items.add(
'flagged',
<div className="Post-flagged">
<div className="Post-flagged-flags">
{flags.map((flag) => (
<div className="Post-flagged-flag">{this.flagReason(flag)}</div>
))}
</div>
<div className="Post-flagged-actions">{this.flagActionItems().toArray()}</div>
</div>
</div>,
110
);
});

Expand Down

0 comments on commit af23ce8

Please sign in to comment.