From e31903cbc9fd9d1230fb4472f25f03f493e79629 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 29 Jul 2020 19:53:00 +0000 Subject: add some context to the notifications --- view/js/main.js | 4 ++-- view/tpl/notifications_widget.tpl | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'view') diff --git a/view/js/main.js b/view/js/main.js index f6a009937..853f2333d 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1550,7 +1550,7 @@ String.prototype.format = function() { var formatted = this; for (var i = 0; i < arguments.length; i++) { var regexp = new RegExp('\\{'+i+'\\}', 'gi'); - formatted = formatted.replace(regexp, arguments[i]); + formatted = formatted.replace(regexp, ((typeof arguments[i] !== 'undefined') ? arguments[i] : '')); } return formatted; }; @@ -1876,7 +1876,7 @@ function sse_handleNotificationsItems(notifyType, data, replace, followup) { } $(data).each(function() { - html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.addr,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum, encodeURIComponent(this.mids)); + html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.addr,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum, encodeURIComponent(this.mids), this.body); notify_menu.append(html); }); diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index bf2c4c945..d8cc76ccb 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -36,12 +36,12 @@ var path = $(this)[0].pathname.substr(1,7); var stateObj = { b64mid: b64mid }; - if(b64mid === 'undefined' && notify_id === 'undefined') + if(! b64mid && ! notify_id) return; {{if $module != 'hq' && $startpage == 'hq'}} e.preventDefault(); - if(typeof notify_id !== 'undefined' && notify_id !== 'undefined') { + if(notify_id != null) { $.post( "hq", { @@ -142,9 +142,9 @@ {{$no_notifications}}...