From fad1e9780a376e1e6ed9d4ab40dc3e10b264dce6 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sat, 23 May 2015 23:23:11 +0500 Subject: [PATCH] check to avoid infinite loop of direct messages postboard updating --- js/twister_directmsg.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/js/twister_directmsg.js b/js/twister_directmsg.js index bdc7576..e4ec9db 100644 --- a/js/twister_directmsg.js +++ b/js/twister_directmsg.js @@ -45,12 +45,11 @@ function processDMsnippet(dmUsers, dmThreadList) { $.MAL.dmThreadListLoaded(); } -function requestDmConversationModal(dmConvo,dm_screenname) { - if( dmConvo.parents(".modal-wrapper").css("display") == 'none' ) - return; - - requestDmConversation(dmConvo,dm_screenname); - setTimeout( function() {requestDmConversationModal(dmConvo,dm_screenname);}, 1000); +function requestDmConversationModal(postboard, dm_screenname) { + if (postboard.is('html *')) { + requestDmConversation(postboard, dm_screenname); + setTimeout(requestDmConversationModal, 1000, postboard, dm_screenname); + } } function requestDmConversation(dmConvo,dm_screenname) {