Skip to content

Commit

Permalink
fix: js error as guest on DiscussionListItem (#4056)
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland authored Oct 3, 2024
1 parent 88f182c commit 6846f42
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions framework/core/js/src/forum/components/DiscussionListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class DiscussionListItem<CustomAttrs extends IDiscussionListItemA
const discussion = this.attrs.discussion;
const controls = DiscussionControls.controls(discussion, this).toArray();

items.add('controls', this.controlsView(controls), 100);
!!controls.length && items.add('controls', this.controlsView(controls), 100);
items.add('slidableUnderneath', this.slidableUnderneathView(), 90);
items.add('content', this.contentView(), 80);

Expand All @@ -83,16 +83,14 @@ export default class DiscussionListItem<CustomAttrs extends IDiscussionListItemA

controlsView(controls: Mithril.ChildArray): Mithril.Children {
return (
!!controls.length && (
<Dropdown
icon="fas fa-ellipsis-v"
className="DiscussionListItem-controls"
buttonClassName="Button Button--icon Button--flat Slidable-underneath Slidable-underneath--right"
accessibleToggleLabel={app.translator.trans('core.forum.discussion_controls.toggle_dropdown_accessible_label')}
>
{controls}
</Dropdown>
)
<Dropdown
icon="fas fa-ellipsis-v"
className="DiscussionListItem-controls"
buttonClassName="Button Button--icon Button--flat Slidable-underneath Slidable-underneath--right"
accessibleToggleLabel={app.translator.trans('core.forum.discussion_controls.toggle_dropdown_accessible_label')}
>
{controls}
</Dropdown>
);
}

Expand Down

0 comments on commit 6846f42

Please sign in to comment.