Fix bug when loading a single post at the start

When loading a single post at the start of a discussion, start=0 and
end=0. But end would be set to start+limit, which was incorrect.
This commit is contained in:
Toby Zerner 2015-01-30 12:15:01 +10:30
parent 37fa92e868
commit c1c6a27dc5

View File

@ -55,7 +55,6 @@ export default Ember.ArrayProxy.extend(Ember.Evented, {
loadRange: function(start, end, backwards) {
var limit = this.get('postLoadCount');
end = end || start + limit;
// Find the appropriate gap objects in the post stream. When we find
// one, we will turn on its loading flag.
@ -93,7 +92,7 @@ export default Ember.ArrayProxy.extend(Ember.Evented, {
// request.) Or, if it's a gap, we'll switch on its loading flag.
var item = this.findNearestToNumber(number);
if (item) {
if (item.get('content.number') === number) {
if (item.get('content.number') == number) {
return Ember.RSVP.resolve([item.get('content')]);
} else if (item.gap) {
item.set('direction', 'down').set('loading', true);