about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteven Tappert <admin@dark-it.net>2018-11-05 18:51:43 +0100
committerEugen Rochko <eugen@zeonfederated.com>2018-11-05 18:51:43 +0100
commita7e3bd0300ee67acfe81c7727baacb0e4e34fead (patch)
tree88752ee87b222d24bf08903cda6894c113c25393
parentd6c7b01d085b083f664cd87b930176fb466c0934 (diff)
Check for empty "last_status" before sorting DM column (#9207)
* Check for empty "last_status" before sorting

* Small touchups for codeclimate
-rw-r--r--app/javascript/mastodon/reducers/conversations.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/javascript/mastodon/reducers/conversations.js b/app/javascript/mastodon/reducers/conversations.js
index b13a9fdf4..955a07754 100644
--- a/app/javascript/mastodon/reducers/conversations.js
+++ b/app/javascript/mastodon/reducers/conversations.js
@@ -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;
+        });
       });
     }