]> cat aescling's git repositories - mastodon.git/commitdiff
Check for empty "last_status" before sorting DM column (#9207)
authorSteven Tappert <admin@dark-it.net>
Mon, 5 Nov 2018 17:51:43 +0000 (18:51 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 5 Nov 2018 17:51:43 +0000 (18:51 +0100)
* Check for empty "last_status" before sorting

* Small touchups for codeclimate

app/javascript/mastodon/reducers/conversations.js

index b13a9fdf4fd253b12642632c1495ca551a982d39..955a07754de087d0b1a74aaa1931f486ed2ee9a2 100644 (file)
@@ -56,7 +56,13 @@ const expandNormalizedConversations = (state, conversations, next) => {
 
         list = list.concat(items);
 
-        return list.sortBy(x => x.get('last_status'), (a, b) => compareId(a, b) * -1);
+        return list.sortBy(x => x.get('last_status'), (a, b) => {
+          if(a === null || b === null) {
+            return -1;
+          }
+
+          return compareId(a, b) * -1;
+        });
       });
     }