FIX: Back button broken navigating from one topic back to another

This commit is contained in:
Robin Ward 2015-04-17 11:52:07 -04:00
parent e8527c5e3e
commit 0660a905b8
2 changed files with 9 additions and 4 deletions

View File

@ -150,12 +150,16 @@ const PostStream = RestModel.extend({
opts = opts || {};
opts.nearPost = parseInt(opts.nearPost, 10);
const topic = this.get('topic'),
self = this;
const topic = this.get('topic');
const self = this;
// Do we already have the post in our list of posts? Jump there.
const postWeWant = this.get('posts').findProperty('post_number', opts.nearPost);
if (postWeWant) { return Ember.RSVP.resolve(); }
if (opts.forceLoad) {
this.set('loaded', false);
} else {
const postWeWant = this.get('posts').findProperty('post_number', opts.nearPost);
if (postWeWant) { return Ember.RSVP.resolve(); }
}
// TODO: if we have all the posts in the filter, don't go to the server for them.
self.set('loadingFilter', true);

View File

@ -18,6 +18,7 @@ export default Discourse.Route.extend({
if (params.nearPost === "last") { params.nearPost = 999999999; }
var self = this;
params.forceLoad = true;
postStream.refresh(params).then(function () {
// TODO we are seeing errors where closest post is null and this is exploding