Fix order of posts on tags-stream for tags including 'activity'
closes #7959
This commit is contained in:
parent
71595b4cbd
commit
2894984f57
3 changed files with 10 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
## Refactor
|
||||
|
||||
## Bug fixes
|
||||
* Fix incorrect post sorting on tag streams and tag searches for tags containing the word "activity" [#7422](https://github.com/diaspora/diaspora/issues/7422)
|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ app.models.Stream = Backbone.Collection.extend({
|
|||
},
|
||||
|
||||
sortOrder : function() {
|
||||
return /activity/.test(this.basePath()) ? "interactedAt" : "createdAt";
|
||||
return /^\/activity/.test(this.basePath()) ? "interactedAt" : "createdAt";
|
||||
},
|
||||
|
||||
/* This function is for adding a large number of posts one by one.
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ describe("app.models.Stream", function() {
|
|||
});
|
||||
|
||||
it("returns a comparator for posts that compares interacted_at and ids for the activity stream", function() {
|
||||
spyOn(stream, "basePath").and.returnValue("activity");
|
||||
spyOn(stream, "basePath").and.returnValue("/activity");
|
||||
this.options = stream.collectionOptions();
|
||||
expect(this.options.comparator(this.post1, this.post2)).toBe(1);
|
||||
expect(this.options.comparator(this.post2, this.post1)).toBe(-1);
|
||||
|
|
@ -37,6 +37,13 @@ describe("app.models.Stream", function() {
|
|||
expect(this.options.comparator(this.post4, this.post1)).toBe(1);
|
||||
expect(this.options.comparator(this.post1, this.post1)).toBe(0);
|
||||
});
|
||||
|
||||
it("returns a comparator for posts that compares created_at and ids for tags including 'activity'", function() {
|
||||
spyOn(stream, "basePath").and.returnValue("/tags/foo-activity-bar");
|
||||
this.options = stream.collectionOptions();
|
||||
expect(this.options.comparator(this.post2, this.post3)).toBe(1);
|
||||
expect(this.options.comparator(this.post3, this.post2)).toBe(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#_fetchOpts", function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue