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:
Blake Erickson 2020-01-06 16:39:16 -07:00 committed by GitHub
parent c30890a385
commit 18d6bcdcbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 4 deletions

View File

@ -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;