Merge pull request #4747 from Raven24/fix_aspect_stream
fix regression caused by updating backbone.js in aspect stream
This commit is contained in:
commit
17754f1da8
4 changed files with 41 additions and 9 deletions
|
|
@ -10,6 +10,8 @@
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Improve time agos by updating the plugin [#4280](https://github.com/diaspora/diaspora/issues/4280)
|
* Improve time agos by updating the plugin [#4280](https://github.com/diaspora/diaspora/issues/4280)
|
||||||
* Use youtube HTTPS scheme for oEmbed [#4743](https://github.com/diaspora/diaspora/pull/4743)
|
* Use youtube HTTPS scheme for oEmbed [#4743](https://github.com/diaspora/diaspora/pull/4743)
|
||||||
|
* Fix infinite scroll on aspect streams [#4729](https://github.com/diaspora/diaspora/issues/4729)
|
||||||
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* You can report a single post by clicking the correct icon in the controler section [#4517](https://github.com/diaspora/diaspora/pull/4517)
|
* You can report a single post by clicking the correct icon in the controler section [#4517](https://github.com/diaspora/diaspora/pull/4517)
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,18 @@ app.models.Stream = Backbone.Collection.extend({
|
||||||
return _.any(this.items.models) ? this.timeFilteredPath() : this.basePath()
|
return _.any(this.items.models) ? this.timeFilteredPath() : this.basePath()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_fetchOpts: function(opts) {
|
||||||
|
var defaultOpts = {
|
||||||
|
remove: false // tell backbone to keep existing items in the collection
|
||||||
|
};
|
||||||
|
return _.extend({}, defaultOpts, opts);
|
||||||
|
},
|
||||||
|
|
||||||
fetch: function() {
|
fetch: function() {
|
||||||
if( this.isFetching() ) return false;
|
if( this.isFetching() ) return false;
|
||||||
var url = this.url();
|
var url = this.url();
|
||||||
this.deferred = this.items.fetch({
|
this.deferred = this.items.fetch(this._fetchOpts({url : url}))
|
||||||
remove : false,
|
.done(_.bind(this.triggerFetchedEvents, this));
|
||||||
url : url
|
|
||||||
}).done(_.bind(this.triggerFetchedEvents, this))
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isFetching : function() {
|
isFetching : function() {
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,7 @@ app.models.StreamAspects = app.models.Stream.extend({
|
||||||
if(this.isFetching()){ return false }
|
if(this.isFetching()){ return false }
|
||||||
var url = this.url();
|
var url = this.url();
|
||||||
var ids = this.aspects_ids;
|
var ids = this.aspects_ids;
|
||||||
this.deferred = this.items.fetch({
|
this.deferred = this.items.fetch(this._fetchOpts({url : url, data : { 'a_ids': ids }}))
|
||||||
add : true,
|
.done(_.bind(this.triggerFetchedEvents, this));
|
||||||
url : url,
|
|
||||||
data : { 'a_ids': ids }
|
|
||||||
}).done(_.bind(this.triggerFetchedEvents, this))
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
28
spec/javascripts/app/models/stream_aspects_spec.js
Normal file
28
spec/javascripts/app/models/stream_aspects_spec.js
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
describe("app.models.StreamAspects", function() {
|
||||||
|
describe("#fetch", function(){
|
||||||
|
var fetch,
|
||||||
|
stream;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
fetch = new $.Deferred();
|
||||||
|
stream = new app.models.StreamAspects([], {aspects_ids: [1,2]});
|
||||||
|
spyOn(stream.items, "fetch").andCallFake(function(options){
|
||||||
|
stream.items.set([{name: 'a'}, {name: 'b'}, {name: 'c'}], options);
|
||||||
|
fetch.resolve();
|
||||||
|
return fetch;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fetches some posts", function(){
|
||||||
|
stream.fetch();
|
||||||
|
expect(stream.items.length).toEqual(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("fetches more posts", function(){
|
||||||
|
stream.fetch();
|
||||||
|
expect(stream.items.length).toEqual(3);
|
||||||
|
stream.fetch();
|
||||||
|
expect(stream.items.length).toEqual(6);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue