This commit is contained in:
Zuzanna 2025-12-04 13:17:07 +01:00
parent 03497e2b71
commit 19dee98e33
7 changed files with 61 additions and 16 deletions

View File

@ -73,6 +73,7 @@ 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;
@ -1455,6 +1456,7 @@ const factory = (UserObject, Util, Hash,
addSharedFolder: callWithEnv(_addSharedFolder),
addPin: addPin,
removePin: removePin,
sendNotification: sendNotification,
// Drive
command: callWithEnv(onCommand),
getPadAttribute: callWithEnv(getPadAttribute),
@ -1833,7 +1835,8 @@ const factory = (UserObject, Util, Hash,
return {
setCustomize,
create: create,
createInner: createInner
createInner: createInner,
sendNotification: sendNotification
};
};

View File

@ -1740,6 +1740,19 @@ const factory = (Sortify, UserObject, ProxyManager,
cb();
};
Store.sendMessageNotif = function () {
console.log("msgs")
store.mailbox.sendTo("GIVE_PAD_ACCESS", {
channel: channel,
href: href,
title: title
}, {
channel: data.user.notifications,
curvePublic: data.user.curvePublic
});
}
// Delete a pad received with a burn after reading URL
var notifyOwnerPadRemoved = function (data, obj) {

View File

@ -181,6 +181,7 @@ const factory = (Messaging, Hash, Util, Crypto, Block) => {
};
// UI for accepted friend request
handlers['FRIEND_REQUEST_ACCEPTED'] = function (ctx, box, data, cb) {
console.log("here")
ctx.updateMetadata();
var curve = data.msg.content.user.curvePublic || data.msg.content.user;
var toRemove = friendRequestDeclined[curve];
@ -193,6 +194,7 @@ const factory = (Messaging, Hash, Util, Crypto, Block) => {
cb(false, toRemove);
};
removeHandlers['FRIEND_REQUEST_ACCEPTED'] = function (ctx, box, data) {
console.log("friend")
var curve = data.content.user.curvePublic || data.content.user;
if (friendRequestAccepted[curve]) { delete friendRequestAccepted[curve]; }
};
@ -347,6 +349,7 @@ const factory = (Messaging, Hash, Util, Crypto, Block) => {
};
handlers['GIVE_PAD_ACCESS'] = function (ctx, box, data, cb) {
console.log("msgs2")
var msg = data.msg;
var content = msg.content;
@ -678,6 +681,7 @@ const factory = (Messaging, Hash, Util, Crypto, Block) => {
// Keep only one notification per channel: the stronger and more recent one
var comments = {};
handlers['COMMENT_REPLY'] = function (ctx, box, data, cb) {
console.log("hello@")
var msg = data.msg;
var hash = data.hash;
var content = msg.content;

View File

@ -368,20 +368,21 @@ proxy.mailboxes = {
};
var notify = box.ready;
Handlers.add(ctx, box, message, function (dismissed, toDismiss, invalid) {
if (toDismiss) { // List of other messages to remove
dismiss(ctx, toDismiss, '', function () {
console.log('Notification handled automatically');
});
}
if (invalid || dismissed) { // This message should be removed
dismiss(ctx, {
type: type,
hash: hash
}, '', function () {
console.log('Notification handled automatically');
});
return;
}
console.log("hello???", toDismiss, invalid, dismissed)
// if (toDismiss) { // List of other messages to remove
// dismiss(ctx, toDismiss, '', function () {
// console.log('Notification handled automatically');
// });
// }
// if (invalid || dismissed) { // This message should be removed
// dismiss(ctx, {
// type: type,
// hash: hash
// }, '', function () {
// console.log('Notification handled automatically');
// });
// return;
// }
msg.ctime = time || 0;
box.content[hash] = msg;
if (opts.dump) { return; }

View File

@ -293,6 +293,7 @@ const factory = (Crypto, Hash, Util, Realtime, Messaging,
};
var onDirectMessage = function (ctx, msg, sender) {
console.log("here!!")
var hk = ctx.store.network.historyKeeper;
if (sender !== hk) { return void onIdMessage(ctx, msg, sender); }
var parsed = JSON.parse(msg);
@ -397,9 +398,15 @@ const factory = (Crypto, Hash, Util, Realtime, Messaging,
};
var onMessage = function (ctx, msg, sender, chan) {
console.log("wkjhdkejdh")
var channel = ctx.channels[chan.id];
if (!channel) { return; }
pushMsg(ctx, channel, msg);
// ctx.emit('FRIEND_REQUEST_ACCEPTED', {
// curvePublic: curvePublic,
// fromMe: true
// }, ctx.friendsClients);
};
var onFriendRemoved = function (ctx, curvePublic, chanId) {

View File

@ -12,7 +12,8 @@ define([
'/common/hyperscript.js',
'/common/diffMarked.js',
'/common/common-icons.js',
], function ($, Messages, Util, UI, UIElements, Badges, h, DiffMd, Icons) {
'/common/proxy-manager.js',
], function ($, Messages, Util, UI, UIElements, Badges, h, DiffMd, Icons, ProxyManager) {
'use strict';
var debug = console.log;
@ -135,6 +136,7 @@ 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');
@ -655,7 +657,17 @@ define([
debug(message);
var el_message = markup.message(message);
console.log("PROXY", message, contactsData)
common.mailbox.sendTo("COMMENT_REPLY", {
channel: channel,
content: "hello"
}, {
channel: contactsData[message.author].notifications,
curvePublic: message.author
})
// ProxyManager.sendNotification()
console.log("hello!!")
if (message.type === 'MSG') {
var name = UI.getDisplayName(typeof message.name !== "undefined" ?
message.name:
@ -666,6 +678,10 @@ define([
force: toolbar && toolbar.team && !toolbar['chat'].hasClass('cp-leftside-active')
});
}
// ctx.emit('FRIEND_REQUEST_ACCEPTED', {
// curvePublic: curvePublic,
// fromMe: true
// }, ctx.friendsClients);
notifyToolbar();
channel.messages.push(message);

View File

@ -364,6 +364,7 @@ define([
};
handlers['COMMENT_REPLY'] = function(common, data) {
console.log("hello$")
var content = data.content;
var msg = content.msg;