From 2b8ca77c0d7e1da2129215941d81a2cd1324bcde Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Thu, 16 Aug 2018 20:36:12 +0200
Subject: [PATCH] Add a safeguard and a TODO to DM notification fix

---
 Resources/Scripts/code.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js
index 94d09729..8ace9a3f 100644
--- a/Resources/Scripts/code.js
+++ b/Resources/Scripts/code.js
@@ -1499,13 +1499,16 @@
         }
         
         if (unread.length > 0){
-          unread.sort(TD.util.chirpReverseColumnSort);
+          if (ensurePropertyExists(TD, "util", "chirpReverseColumnSort")){
+            unread.sort(TD.util.chirpReverseColumnSort);
+          }
           
           for(let message of unread){
             onNewTweet(this, message);
           }
           
           // TODO sound notifications are borked as well
+          // TODO figure out what to do with missed notifications at startup
         }
       }
     });