Unverified Commit 2894984f authored by Benjamin Neff's avatar Benjamin Neff Committed by Dennis Schubert

Fix order of posts on tags-stream for tags including 'activity'

closes #7959
parent 71595b4c
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment