From aed81c1b3bd14bed84d426ab59a44682ef9502cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabi=C3=A1n=20Rodr=C3=ADguez?= <fabian@wyeworks.com>
Date: Sun, 28 Apr 2013 20:41:08 -0300
Subject: [PATCH] Fix tags ordering in chrome

---
 Changelog.md                                                    | 1 +
 app/assets/javascripts/app/collections/tag_followings.js        | 2 +-
 .../app/collections/tag_following_collection_spec.js            | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Changelog.md b/Changelog.md
index a7540635bd..7255415d95 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -10,6 +10,7 @@
 * Don't use Pathname early to circumvent some rare initialization errors [#3816](https://github.com/diaspora/diaspora/issues/3816)
 * Don't error out in script/server if git is unavailable.
 * Fix post preview from tag pages [#4157](https://github.com/diaspora/diaspora/issues/4157)
+* Fix tags ordering in chrome [#4133](https://github.com/diaspora/diaspora/issues/4133)
 
 ## Features
 
diff --git a/app/assets/javascripts/app/collections/tag_followings.js b/app/assets/javascripts/app/collections/tag_followings.js
index ab0a9f7839..870878ba71 100644
--- a/app/assets/javascripts/app/collections/tag_followings.js
+++ b/app/assets/javascripts/app/collections/tag_followings.js
@@ -3,7 +3,7 @@ app.collections.TagFollowings = Backbone.Collection.extend({
   model: app.models.TagFollowing,
   url : "/tag_followings",
   comparator: function(first_tf, second_tf) {
-    return first_tf.get("name") < second_tf.get("name");
+    return  -first_tf.get("name").localeCompare(second_tf.get("name"));
   },
 
   create : function(model) {
diff --git a/spec/javascripts/app/collections/tag_following_collection_spec.js b/spec/javascripts/app/collections/tag_following_collection_spec.js
index cffdd4ae66..b3b4c646cd 100644
--- a/spec/javascripts/app/collections/tag_following_collection_spec.js
+++ b/spec/javascripts/app/collections/tag_following_collection_spec.js
@@ -7,7 +7,7 @@ describe("app.collections.TagFollowings", function(){
     it("should compare in reverse order", function() {
       var a = new app.models.TagFollowing({name: "aaa"}),
           b = new app.models.TagFollowing({name: "zzz"})
-      expect(this.collection.comparator(a, b)).toBe(true)
+      expect(this.collection.comparator(a, b)).toBeGreaterThan(0)
     })
   })
 
-- 
GitLab