mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
cleaning
This commit is contained in:
parent
58a962aa5d
commit
2b1e64ec8a
@ -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
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 () {
|
||||
|
||||
@ -122,8 +122,6 @@ define([
|
||||
channel: data.notifications,
|
||||
curvePublic: data.curvePublic
|
||||
});
|
||||
|
||||
console.log("here!", privateData.channel, data.notifications, data.curvePublic)
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user