FIX: Update topic-list-item to reflect changes in core (#59)
* FIX: Update topic-list-item to reflect changes in core This PR in discourse core: https://github.com/discourse/discourse/pull/8589 makes a breaking change in this plugin. This is a fix for it. * add backwards compatible fix * Apply prettier fix
This commit is contained in:
parent
c30890a385
commit
18d6bcdcbd
|
@ -1,5 +1,21 @@
|
|||
import { ListItemDefaults } from "discourse/components/topic-list-item";
|
||||
import {
|
||||
ListItemDefaults,
|
||||
default as TopicListItem
|
||||
} from "discourse/components/topic-list-item";
|
||||
|
||||
export default Ember.Component.extend(ListItemDefaults, {
|
||||
isPrivateMessage: Ember.computed.equal("topic.archetype", "private_message")
|
||||
});
|
||||
// This is a backward compatible fix so that this change:
|
||||
// https://github.com/discourse/discourse/pull/8589
|
||||
// in discourse core doesn't break this plugin.
|
||||
let assignedTopicListItem = null;
|
||||
|
||||
if (ListItemDefaults) {
|
||||
assignedTopicListItem = Ember.Component.extend(ListItemDefaults, {
|
||||
isPrivateMessage: Ember.computed.equal("topic.archetype", "private_message")
|
||||
});
|
||||
} else {
|
||||
assignedTopicListItem = TopicListItem.extend({
|
||||
isPrivateMessage: Ember.computed.equal("topic.archetype", "private_message")
|
||||
});
|
||||
}
|
||||
|
||||
export default assignedTopicListItem;
|
||||
|
|
Loading…
Reference in New Issue