diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js index 8ace9a3f..4d011976 100644 --- a/Resources/Scripts/code.js +++ b/Resources/Scripts/code.js @@ -1514,6 +1514,24 @@ }); } + // + // Block: Fix DMs not being marked as read when replying to them. + // + execSafe(function markRepliedDMsAsRead(){ + throw 1 if !ensurePropertyExists(TD, "controller", "clients", "getClient"); + throw 2 if !ensurePropertyExists(TD, "services", "Conversations", "prototype", "getConversation"); + + $(document).on("dataDmSent", function(e, data){ + let client = TD.controller.clients.getClient(data.request.accountKey); + return if !client; + + let conversation = client.conversations.getConversation(data.request.conversationId); + return if !conversation; + + conversation.markAsRead(); + }); + }); + // // Block: Limit amount of loaded DMs to avoid massive lag from re-opening them several times. //