Improve team invitation notifications

pull/1/head
yflory 4 years ago
parent 63a7609a55
commit 6aac0b91ce

@ -448,6 +448,8 @@ define([
} catch (e) { console.error(e); } } catch (e) { console.error(e); }
} }
var userData = content.user || content;
console.log(1);
box.sendMessage({ box.sendMessage({
type: 'INVITE_TO_TEAM_ANSWERED', type: 'INVITE_TO_TEAM_ANSWERED',
content: { content: {
@ -456,6 +458,7 @@ define([
answer: content.answer answer: content.answer
} }
}, function () {}); }, function () {});
console.log(2);
cb(true); cb(true);
}; };
@ -657,9 +660,15 @@ define([
if (!data.msg) { return void cb(true); } if (!data.msg) { return void cb(true); }
// Check if the request is valid (sent by the correct user) // Check if the request is valid (sent by the correct user)
var myCurve = Util.find(ctx, ['store', 'proxy', 'curvePublic']);
var curve = Util.find(data, ['msg', 'content', 'user', 'curvePublic']) || var curve = Util.find(data, ['msg', 'content', 'user', 'curvePublic']) ||
Util.find(data, ['msg', 'content', 'curvePublic']); Util.find(data, ['msg', 'content', 'curvePublic']);
if (curve && data.msg.author !== curve) { console.error('blocked'); return void cb(true); } // Block messages that are not coming from the user described in the message
// except if the author is ourselves.
if (curve && data.msg.author !== curve && data.msg.author !== myCurve) {
console.error('blocked');
return void cb(true);
}
var type = data.msg.type; var type = data.msg.type;

@ -258,6 +258,7 @@ proxy.mailboxes = {
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
console.error('test');
sendMessage(msg, function (err, hash) { sendMessage(msg, function (err, hash) {
if (err) { return void console.error(err); } if (err) { return void console.error(err); }
box.history.push(hash); box.history.push(hash);

Loading…
Cancel
Save