diff --git a/src/common/proxy-manager.js b/src/common/proxy-manager.js index 14a5e2cb5..0472eeeb5 100644 --- a/src/common/proxy-manager.js +++ b/src/common/proxy-manager.js @@ -73,7 +73,6 @@ const factory = (UserObject, Util, Hash, }; var sendNotification = (Env, sfId, title) => { - console.log("bloop") var mailbox = Env.store.mailbox; if (!mailbox) { return; } var team = Env.cfg.teamId; @@ -1456,7 +1455,6 @@ const factory = (UserObject, Util, Hash, addSharedFolder: callWithEnv(_addSharedFolder), addPin: addPin, removePin: removePin, - sendNotification: sendNotification, // Drive command: callWithEnv(onCommand), getPadAttribute: callWithEnv(getPadAttribute), @@ -1836,7 +1834,6 @@ const factory = (UserObject, Util, Hash, setCustomize, create: create, createInner: createInner, - sendNotification: sendNotification }; }; diff --git a/src/worker/components/mailbox-handlers.js b/src/worker/components/mailbox-handlers.js index cf67a740a..c3945bd89 100644 --- a/src/worker/components/mailbox-handlers.js +++ b/src/worker/components/mailbox-handlers.js @@ -259,45 +259,45 @@ const factory = (Messaging, Hash, Util, Crypto, Block) => { // Keep only one notification per channel: the stronger and more recent one var channels = {}; handlers['SHARE_PAD'] = function (ctx, box, data, cb) { - // console.log("here2") + console.log("here2") - // var msg = data.msg; - // var hash = data.hash; - // var content = msg.content; - // // content.name, content.title, content.href, content.password + var msg = data.msg; + var hash = data.hash; + var content = msg.content; + // content.name, content.title, content.href, content.password - // if (isMuted(ctx, data)) { return void cb(true); } - // // if the shared content is a 'link' then we can't use the channel to deduplicate notifications - // // use href instead. - // var channel = content.isStatic ? content.href : Hash.hrefToHexChannelId(content.href, content.password); - // var parsed = Hash.parsePadUrl(content.href); - // var mode = parsed.hashData && parsed.hashData.mode || 'n/a'; + if (isMuted(ctx, data)) { return void cb(true); } + // if the shared content is a 'link' then we can't use the channel to deduplicate notifications + // use href instead. + var channel = content.isStatic ? content.href : Hash.hrefToHexChannelId(content.href, content.password); + var parsed = Hash.parsePadUrl(content.href); + var mode = parsed.hashData && parsed.hashData.mode || 'n/a'; - // var old = channels[channel]; - // var toRemove; - // if (old) { - // // New hash is weaker, ignore - // if (old.mode === 'edit' && mode === 'view') { - // return void cb(true); - // } - // // New hash is not weaker, clear the old one - // toRemove = old.data; - // } + var old = channels[channel]; + var toRemove; + if (old) { + // New hash is weaker, ignore + if (old.mode === 'edit' && mode === 'view') { + return void cb(true); + } + // New hash is not weaker, clear the old one + toRemove = old.data; + } - // if (content.password) { - // content.password = encryptPassword(ctx, content.password); - // } + if (content.password) { + content.password = encryptPassword(ctx, content.password); + } - // // Update the data - // channels[channel] = { - // mode: mode, - // data: { - // type: box.type, - // hash: hash - // } - // }; + // Update the data + channels[channel] = { + mode: mode, + data: { + type: box.type, + hash: hash + } + }; - // cb(false, toRemove); + cb(false, toRemove); }; removeHandlers['SHARE_PAD'] = function (ctx, box, data, hash) { // var content = data.content; diff --git a/www/common/messenger-ui.js b/www/common/messenger-ui.js index 6bb44beeb..630528771 100644 --- a/www/common/messenger-ui.js +++ b/www/common/messenger-ui.js @@ -13,7 +13,7 @@ define([ '/common/diffMarked.js', '/common/common-icons.js', '/common/proxy-manager.js', -], function ($, Messages, Util, UI, UIElements, Badges, h, DiffMd, Icons, ProxyManager) { +], function ($, Messages, Util, UI, UIElements, Badges, h, DiffMd, Icons) { 'use strict'; var debug = console.log; @@ -136,7 +136,6 @@ define([ var notify = function (id) { find.inList(id).addClass('cp-app-contacts-notify'); - }; var unnotify = function (id) { find.inList(id).removeClass('cp-app-contacts-notify'); @@ -658,7 +657,6 @@ define([ var el_message = markup.message(message); - if (message.type === 'MSG') { var name = UI.getDisplayName(typeof message.name !== "undefined" ? message.name: @@ -684,7 +682,6 @@ define([ curvePublic: message.author }) } - } notifyToolbar(); diff --git a/www/common/notifications.js b/www/common/notifications.js index 395d07295..1b6eb459f 100644 --- a/www/common/notifications.js +++ b/www/common/notifications.js @@ -660,17 +660,17 @@ define([ return { add: function(common, data) { - // var type = data.content.msg.type; + var type = data.content.msg.type; - // if (handlers[type]) { - // handlers[type](common, data); - // // add getters to access simply some informations - // data.content.isClickable = typeof data.content.handler === "function"; - // data.content.isDismissible = typeof data.content.dismissHandler === "function"; - // } else { - // data.content.dismissHandler = defaultDismiss(common, data); - // data.content.isDismissible = typeof data.content.dismissHandler === "function"; - // } + if (handlers[type]) { + handlers[type](common, data); + // add getters to access simply some informations + data.content.isClickable = typeof data.content.handler === "function"; + data.content.isDismissible = typeof data.content.dismissHandler === "function"; + } else { + data.content.dismissHandler = defaultDismiss(common, data); + data.content.isDismissible = typeof data.content.dismissHandler === "function"; + } }, remove: function(common, data) { common.removeFriendRequest(data.hash); diff --git a/www/notifications/inner.js b/www/notifications/inner.js index 3b86b8f6e..1c0700ba1 100644 --- a/www/notifications/inner.js +++ b/www/notifications/inner.js @@ -189,9 +189,9 @@ define([ }; create['pads'] = function () { - // var key = 'pads'; - // var filter = ["SHARE_PAD"]; - // return makeNotificationList(key, filter); + var key = 'pads'; + var filter = ["SHARE_PAD"]; + return makeNotificationList(key, filter); }; create['archived'] = function () { diff --git a/www/pad/comments.js b/www/pad/comments.js index ee455513f..5c313b081 100644 --- a/www/pad/comments.js +++ b/www/pad/comments.js @@ -122,8 +122,6 @@ define([ channel: data.notifications, curvePublic: data.curvePublic }); - - console.log("here!", privateData.channel, data.notifications, data.curvePublic) }); };