Skip to content

Commit

Permalink
fix: compat: still return controls view item, even if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Oct 3, 2024
1 parent 1c71ee0 commit feaaf8c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 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();

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

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

controlsView(controls: Mithril.ChildArray): Mithril.Children {
return (
<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>
<>
{!!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>
)}
</>
);
}

Expand Down

0 comments on commit feaaf8c

Please sign in to comment.