mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 06:53:47 +08:00
Update for discussion list refactoring
This commit is contained in:
parent
7a75e424d7
commit
7e99bcd555
|
@ -1,5 +1,5 @@
|
||||||
import { extend } from 'flarum/extension-utils';
|
import { extend } from 'flarum/extension-utils';
|
||||||
import DiscussionList from 'flarum/components/discussion-list';
|
import DiscussionListItem from 'flarum/components/discussion-list-item';
|
||||||
import DiscussionPage from 'flarum/components/discussion-page';
|
import DiscussionPage from 'flarum/components/discussion-page';
|
||||||
import DiscussionHero from 'flarum/components/discussion-hero';
|
import DiscussionHero from 'flarum/components/discussion-hero';
|
||||||
|
|
||||||
|
@ -8,14 +8,11 @@ import sortTags from 'flarum-tags/utils/sort-tags';
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
// Add tag labels to each discussion in the discussion list.
|
// Add tag labels to each discussion in the discussion list.
|
||||||
extend(DiscussionList.prototype, 'infoItems', function(items, discussion) {
|
extend(DiscussionListItem.prototype, 'infoItems', function(items) {
|
||||||
var tags = discussion.tags();
|
var tags = this.props.discussion.tags();
|
||||||
if (tags) {
|
if (tags && tags.length) {
|
||||||
tags = tags.filter(tag => tag.slug() !== this.props.params.tags);
|
|
||||||
if (tags.length) {
|
|
||||||
items.add('tags', tagsLabel(tags), {first: true});
|
items.add('tags', tagsLabel(tags), {first: true});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Include a discussion's tags when fetching it.
|
// Include a discussion's tags when fetching it.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user