Only display in discovery, correct double highlighting
This commit is contained in:
parent
11f9a463ac
commit
9b1e81cd6d
|
@ -33,13 +33,20 @@ export default Ember.Component.extend({
|
|||
|
||||
@computed('topics.@each')
|
||||
lastVisitedTopic() {
|
||||
if (!this.get('highlightLastVisited')) { return; }
|
||||
|
||||
let user = Discourse.User.current();
|
||||
if (!user || !user.previous_visit_at) {
|
||||
return;
|
||||
}
|
||||
|
||||
let prevVisit = user.get('previousVisitAt');
|
||||
let prevTopic, topic;
|
||||
prevTopic = this.get('prevTopic');
|
||||
if (prevTopic) {
|
||||
return prevTopic;
|
||||
}
|
||||
|
||||
let prevVisit = user.get('previousVisitAt');
|
||||
let skipPinned = true;
|
||||
|
||||
this.get('topics').any(t => {
|
||||
|
@ -53,11 +60,16 @@ export default Ember.Component.extend({
|
|||
return t.get('bumpedAt') < prevVisit;
|
||||
});
|
||||
|
||||
|
||||
if (!prevTopic || !topic) {
|
||||
return;
|
||||
}
|
||||
|
||||
// end of list that was scanned
|
||||
if (topic.get('bumpedAt') > prevVisit) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set('prevTopic', prevTopic);
|
||||
return prevTopic;
|
||||
},
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
{{#if hasTopics}}
|
||||
{{topic-list
|
||||
highlightLastVisited=true
|
||||
showTopicPostBadges=showTopicPostBadges
|
||||
showPosters=true
|
||||
currentUser=currentUser
|
||||
|
|
Loading…
Reference in New Issue