aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-19 09:33:00 +0000
committerMario <mario@mariovavti.com>2019-11-19 09:33:00 +0000
commitbd049eddd4fa79d6960746d884fc6f5c8defd8e8 (patch)
tree3205cfb7e8f24b95a56ea4c87981cf802dc2ed74
parentef75d27afbbee4cfe7d4441269e350b8f7f432f9 (diff)
downloadvolse-hubzilla-bd049eddd4fa79d6960746d884fc6f5c8defd8e8.tar.gz
volse-hubzilla-bd049eddd4fa79d6960746d884fc6f5c8defd8e8.tar.bz2
volse-hubzilla-bd049eddd4fa79d6960746d884fc6f5c8defd8e8.zip
sse: fix notifications visible for loaded items when the items were loaded before the notifications
-rw-r--r--view/js/main.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 19e73c1d2..fec86f4ba 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -30,6 +30,7 @@ var sse_bs_active = false;
var sse_offset = 0;
var sse_type;
var sse_partial_result = false;
+var sse_mids;
// take care of tab/window reloads on channel change
if(localStorage.getItem('uid') !== localUser.toString()) {
@@ -310,7 +311,7 @@ function handle_comment_form(e) {
ex_form.find('.comment-edit-text').removeClass('expanded').attr('placeholder', aStr.comment);
ex_form.find(':not(.comment-edit-text)').hide();
}
- i++
+ i++;
});
}
@@ -858,12 +859,15 @@ function updateConvItems(mode,data) {
}
});
+ sse_mids = [];
// take care of the notifications count updates
$('.thread-wrapper', data).each(function() {
var nmid = $(this).data('b64mid');
+ sse_mids.push(nmid);
+
if($('.notification[data-b64mid=\'' + nmid + '\']').length) {
$('.notification[data-b64mid=\'' + nmid + '\']').each(function() {
var n = this.parentElement.id.split('-');
@@ -893,6 +897,7 @@ function updateConvItems(mode,data) {
});
+ //console.log(sse_mids);
// reset rotators and cursors we may have set before reaching this place
@@ -2072,6 +2077,10 @@ function sse_handleNotificationsItems(notifyType, data, replace, followup) {
}
$(data).each(function() {
+ if(sse_mids.indexOf(this.b64mid) >= 0) {
+ console.log('dismiss: ' + this.b64mid);
+ return true;
+ }
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);
notify_menu.append(html);
});