Improve team invitation notifications

This commit is contained in:
yflory 2020-08-31 11:00:46 +02:00
parent 63a7609a55
commit 6aac0b91ce
2 changed files with 11 additions and 1 deletions

View file

@ -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;

View file

@ -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);