From 7876df0a5032a4ca0388615e49a56cb9c8d70d6f Mon Sep 17 00:00:00 2001 From: tmp-server Date: Sat, 16 Oct 2021 02:34:44 +0000 Subject: [PATCH] Fix new thread notifications title, fix thread body breaking script Tried to access invalid child. --- js/mod/recent-posts-auto-reload.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/mod/recent-posts-auto-reload.js b/js/mod/recent-posts-auto-reload.js index 5ed0547e..17f15175 100644 --- a/js/mod/recent-posts-auto-reload.js +++ b/js/mod/recent-posts-auto-reload.js @@ -191,8 +191,13 @@ $(document).ready(function(){ // check that this post doesn't already exist if($('#' + id).length == 0) { if (notify) { - var body = $(this).children('.body').html().replace(//gi, "\n"); - var n = new Notification("New reply to "+ title, {body: $('
').html(body).text()}); + if ($(this).hasClass('thread')){ + var body = $(this).children('.post').children('.body').html().replace(//gi, "\n"); + var n = new Notification("New thread in "+ title, {body: $('
').html(body).text()}); + } else { + var body = $(this).children('.body').html().replace(//gi, "\n"); + var n = new Notification("New reply to "+ title, {body: $('
').html(body).text()}); + } } $(this).parent().insertBefore($('.post-wrapper:first')); new_posts++;