Don't show your own team notifications

pull/1/head
yflory 5 years ago
parent cb36a49908
commit 0390d3df75

@ -281,7 +281,6 @@ define([
if (mailbox) { // Friend
if (friends[curve] && !mailbox.notifications) { return; }
if (mailbox.notifications && mailbox.curvePublic) {
// XXX we should mark this notification as "viewed" in our own proxy
common.mailbox.sendTo("SHARE_PAD", {
href: href,
password: config.password,
@ -289,6 +288,7 @@ define([
name: myName,
title: title
}, {
viewed: team && team.id,
channel: mailbox.notifications,
curvePublic: mailbox.curvePublic
});

@ -109,6 +109,17 @@ proxy.mailboxes = {
});
var ciphertext = crypto.encrypt(text, user.curvePublic);
// If we've sent this message to one of our teams' mailbox, we may want to "dismiss" it
// automatically
if (user.viewed) {
var team = Util.find(ctx, ['store', 'proxy', 'teams', user.viewed]);
if (team) {
var hash = ciphertext.slice(0,64);
var viewed = Util.find(team, ['keys', 'mailbox', 'viewed']);
if (Array.isArray(viewed)) { viewed.push(hash); }
}
}
anonRpc.send("WRITE_PRIVATE_MESSAGE", [
user.channel,
ciphertext

Loading…
Cancel
Save