From 1bcdf1bbf860a77fc998a2dba54f519ee584aaf6 Mon Sep 17 00:00:00 2001 From: Steven Tappert Date: Sun, 4 Nov 2018 16:48:57 +0100 Subject: [PATCH 1/2] Check for empty "last_status" before sorting --- app/javascript/mastodon/reducers/conversations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/reducers/conversations.js b/app/javascript/mastodon/reducers/conversations.js index b13a9fdf4fd25..60035f9f5abad 100644 --- a/app/javascript/mastodon/reducers/conversations.js +++ b/app/javascript/mastodon/reducers/conversations.js @@ -56,7 +56,7 @@ 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; compareId(a, b) * -1}); }); } From e1c3544889e01b783c52bfc00a97027cd6e23c9a Mon Sep 17 00:00:00 2001 From: Steven Tappert Date: Sun, 4 Nov 2018 17:06:04 +0100 Subject: [PATCH 2/2] Small touchups for codeclimate --- app/javascript/mastodon/reducers/conversations.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/reducers/conversations.js b/app/javascript/mastodon/reducers/conversations.js index 60035f9f5abad..955a07754de08 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) => { if(a === null || b === null) return -1; 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; + }); }); }