From: David ‘Bombe’ Roden Date: Wed, 8 Jun 2011 14:00:32 +0000 (+0200) Subject: Show posts mentioning a local Sone by a new notification. X-Git-Tag: 0.6.5^2~9 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=9d50dcb65cec8d10306fbdb0d73826f33af2afb9;hp=8908979c7d8edf18c629c0d38f4a6078b639ca6b Show posts mentioning a local Sone by a new notification. This fixes #188. --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index a489c60..0cc6480 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1235,6 +1235,14 @@ function loadNewPost(postId, soneId, recipientId, time) { } }); newPost = $(data.post.html).addClass("hidden"); + if ($(".post-author-local", newPost).text() == "true") { + newPost.removeClass("new"); + (function(newPost) { + setTimeout(function() { + markPostAsKnown(newPost, false); + }, 5000); + })(newPost); + } if (firstOlderPost != null) { newPost.insertBefore(firstOlderPost); } @@ -1268,6 +1276,14 @@ function loadNewReply(replyId, soneId, postId, postSoneId) { } }); newReply = $(data.reply.html).addClass("hidden"); + if ($(".reply-author-local", newReply).text() == "true") { + newReply.removeClass("new"); + (function(newReply) { + setTimeout(function() { + markReplyAsKnown(newReply, false); + }, 5000); + })(newReply); + } if (firstNewerReply != null) { newReply.insertBefore(firstNewerReply); } else { @@ -1308,7 +1324,7 @@ function markSoneAsKnown(soneElement, skipRequest) { function markPostAsKnown(postElements, skipRequest) { $(postElements).each(function() { postElement = this; - if ($(postElement).hasClass("new")) { + if ($(postElement).hasClass("new") || ((typeof skipRequest != "undefined") && !skipRequest)) { (function(postElement) { $(postElement).removeClass("new"); if ((typeof skipRequest == "undefined") || !skipRequest) { @@ -1324,7 +1340,7 @@ function markPostAsKnown(postElements, skipRequest) { function markReplyAsKnown(replyElements, skipRequest) { $(replyElements).each(function() { replyElement = this; - if ($(replyElement).hasClass("new")) { + if ($(replyElement).hasClass("new") || ((typeof skipRequest != "undefined") && !skipRequest)) { (function(replyElement) { $(replyElement).removeClass("new"); if ((typeof skipRequest == "undefined") || !skipRequest) { diff --git a/src/main/resources/templates/include/viewPost.html b/src/main/resources/templates/include/viewPost.html index 8b7ccb8..b451f2b 100644 --- a/src/main/resources/templates/include/viewPost.html +++ b/src/main/resources/templates/include/viewPost.html @@ -2,6 +2,7 @@ +
<%if post.loaded> Avatar Image diff --git a/src/main/resources/templates/include/viewReply.html b/src/main/resources/templates/include/viewReply.html index 2fa4885..2507917 100644 --- a/src/main/resources/templates/include/viewReply.html +++ b/src/main/resources/templates/include/viewReply.html @@ -2,6 +2,7 @@ +
Avatar Image