mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
correct regressions, not loading topics on click
This commit is contained in:
parent
ef976ba891
commit
24131bcc0e
2 changed files with 17 additions and 7 deletions
|
@ -56,10 +56,11 @@ Discourse.TopicList = Discourse.Model.extend({
|
|||
// loads topics with these ids "before" the current topics
|
||||
loadBefore: function(topic_ids){
|
||||
var _this = this;
|
||||
Discourse.TopicList.loadTopics(topic_ids, this.get('filter'))
|
||||
.then(function(topics){
|
||||
var topics = this.get('topics');
|
||||
|
||||
_this.forEachNew(topics, function(t) {
|
||||
Discourse.TopicList.loadTopics(topic_ids, this.get('filter'))
|
||||
.then(function(newTopics){
|
||||
_this.forEachNew(newTopics, function(t) {
|
||||
// highlight the first of the new topics so we can get a visual feedback
|
||||
t.set('highlight', true);
|
||||
topics.insertAt(0,t);
|
||||
|
|
|
@ -141,6 +141,15 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
this.get('topicTrackingState').trackIncoming("all");
|
||||
},
|
||||
|
||||
debounceLoadSuggested: Discourse.debounce(function(lookup){
|
||||
var suggested = this.get('topic.suggested_topics');
|
||||
|
||||
Discourse.TopicList.loadTopics(lookup, "").then(function(topics){
|
||||
suggested.clear();
|
||||
suggested.pushObjects(topics);
|
||||
});
|
||||
}, 1000),
|
||||
|
||||
hasNewSuggested: function(){
|
||||
var incoming = this.get('topicTrackingState.newIncoming');
|
||||
var suggested = this.get('topic.suggested_topics');
|
||||
|
@ -157,10 +166,10 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
});
|
||||
}
|
||||
|
||||
Discourse.TopicList.loadTopics(lookup, "").then(function(topics){
|
||||
suggested.clear();
|
||||
suggested.pushObjects(topics);
|
||||
});
|
||||
var topicId = this.get('topic.id');
|
||||
lookup = lookup.exclude(function(id){ return id === topicId; });
|
||||
|
||||
this.debounceLoadSuggested(lookup);
|
||||
}
|
||||
}.observes('topicTrackingState.incomingCount'),
|
||||
|
||||
|
|
Loading…
Reference in a new issue