Don't send user updates to friends via chat if you know their mailbox

This commit is contained in:
yflory
2019-09-02 18:19:56 +02:00
parent 772ecb7365
commit d190b8acd0
3 changed files with 18 additions and 6 deletions

View File

@@ -229,6 +229,11 @@ define([
});
};
messenger.onFriendUpdate = function (curve) {
var friend = getFriend(proxy, curve);
checkFriendData(curve, friend, friend.channel);
};
// Id message allows us to map a netfluxId with a public curve key
var onIdMessage = function (msg, sender) {
var channel, parsed0;
@@ -373,12 +378,14 @@ define([
|| mySyncData.profile !== myData.profile
|| mySyncData.avatar !== myData.avatar) {
delete myData.channel;
Object.keys(channels).forEach(function (chan) {
var channel = channels[chan];
Object.keys(friends).forEach(function (curve) {
var friend = friends[curve];
var chan = friend.channel;
if (friend.notifications) { return; }
if (!chan) { return; }
if (!channel) {
return void console.error('NO_SUCH_CHANNEL');
}
var channel = channels[chan];
if (!channel) { return; }
if (channel.readOnly) { return; }
var msg = [Types.update, myData.curvePublic, +new Date(), myData];
@@ -396,7 +403,6 @@ define([
info: myData,
types: ['displayName', 'profile', 'avatar'],
});
friends.me = myData;
}
};