Skip to content

Commit a286ec4

Browse files
fix(core): revert extensibility improvements for replyCountItem()
This fixes a breaking change with third-party extensions calling `replyCountItem()` and not expecting it to be an array.
1 parent b49b310 commit a286ec4

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

framework/core/js/src/forum/components/DiscussionListItem.tsx

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export default class DiscussionListItem<CustomAttrs extends IDiscussionListItemA
128128
items.add('authorAvatar', this.authorAvatarView(), 100);
129129
items.add('badges', this.badgesView(), 90);
130130
items.add('main', this.mainView(), 80);
131-
items.add('replyCount', this.replyCountItem().toArray(), 70);
131+
items.add('replyCount', this.replyCountItem(), 70);
132132

133133
return items;
134134
}
@@ -274,38 +274,30 @@ export default class DiscussionListItem<CustomAttrs extends IDiscussionListItemA
274274
return items;
275275
}
276276

277-
replyCountItem(): ItemList<Mithril.Children> {
278-
const items = new ItemList<Mithril.Children>();
279-
277+
replyCountItem() {
280278
const discussion = this.attrs.discussion;
281279
const showUnread = !this.showRepliesCount() && discussion.isUnread();
282280

283281
if (showUnread) {
284-
items.add(
285-
'unreadCount',
282+
return (
286283
<button className="Button--ua-reset DiscussionListItem-count" onclick={this.markAsRead.bind(this)}>
287284
<span aria-hidden="true">{abbreviateNumber(discussion.unreadCount())}</span>
288285

289286
<span className="visually-hidden">
290287
{app.translator.trans('core.forum.discussion_list.unread_replies_a11y_label', { count: discussion.replyCount() })}
291288
</span>
292-
</button>,
293-
100
294-
);
295-
} else {
296-
items.add(
297-
'count',
298-
<span className="DiscussionListItem-count">
299-
<span aria-hidden="true">{abbreviateNumber(discussion.replyCount())}</span>
300-
301-
<span className="visually-hidden">
302-
{app.translator.trans('core.forum.discussion_list.total_replies_a11y_label', { count: discussion.replyCount() })}
303-
</span>
304-
</span>,
305-
100
289+
</button>
306290
);
307291
}
308292

309-
return items;
293+
return (
294+
<span className="DiscussionListItem-count">
295+
<span aria-hidden="true">{abbreviateNumber(discussion.replyCount())}</span>
296+
297+
<span className="visually-hidden">
298+
{app.translator.trans('core.forum.discussion_list.total_replies_a11y_label', { count: discussion.replyCount() })}
299+
</span>
300+
</span>
301+
);
310302
}
311303
}

0 commit comments

Comments
 (0)