Don't add a notice if it already exists on the page

Try not to interfere with Ajax posting; don't show something if it's
already on the page.
This commit is contained in:
Evan Prodromou 2009-04-26 21:15:11 -04:00
parent db3b56a2fd
commit e97223b2ba

View File

@ -23,6 +23,14 @@ var updater = function()
function receive(message) function receive(message)
{ {
id = message.data.id;
// Don't add it if it already exists
if ($("#notice-"+id).length > 0) {
return;
}
var noticeItem = makeNoticeItem(message.data); var noticeItem = makeNoticeItem(message.data);
$("#notices_primary .notices").prepend(noticeItem, true); $("#notices_primary .notices").prepend(noticeItem, true);
$("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").css({display:"none"});