From 4c5f5e2cce2d16b6b9f5a22757756a94f597b70b Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Tue, 16 May 2017 20:23:08 +0200
Subject: [PATCH] Fix DM notifications not showing if the conversation is open

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

diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js
index 3d4f20c3..f41dcb32 100644
--- a/Resources/Scripts/code.js
+++ b/Resources/Scripts/code.js
@@ -661,6 +661,17 @@
     }, 100);
   });
   
+  //
+  // Block: Fix DM notifications not showing if the conversation is open.
+  //
+  (function(prevFunc){
+    TD.services.TwitterConversation.prototype.getUnreadChirps = function(e){
+      return (e && e.sortIndex && !e.id && !this.notificationsDisabled)
+        ? this.messages.filter(t => t.chirpType === TD.services.ChirpBase.MESSAGE && !t.isOwnChirp() && !t.read && !t.belongsBelow(e)) // changed from belongsAbove
+        : prevFunc.apply(this, arguments);
+    };
+  })(TD.services.TwitterConversation.prototype.getUnreadChirps);
+  
   //
   // Block: Disable TweetDeck metrics.
   //