Don't send user updates to friends via chat if you know their mailbox
This commit is contained in:
parent
772ecb7365
commit
d190b8acd0
@ -83,6 +83,9 @@ define([
|
|||||||
store.messenger.updateMyData();
|
store.messenger.updateMyData();
|
||||||
}
|
}
|
||||||
var myData = createData(store.proxy);
|
var myData = createData(store.proxy);
|
||||||
|
if (store.proxy.friends) {
|
||||||
|
store.proxy.friends.me = myData;
|
||||||
|
}
|
||||||
var todo = function (friend) {
|
var todo = function (friend) {
|
||||||
if (!friend || !friend.notifications) { return; }
|
if (!friend || !friend.notifications) { return; }
|
||||||
myData.channel = friend.channel;
|
myData.channel = friend.channel;
|
||||||
|
|||||||
@ -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
|
// Id message allows us to map a netfluxId with a public curve key
|
||||||
var onIdMessage = function (msg, sender) {
|
var onIdMessage = function (msg, sender) {
|
||||||
var channel, parsed0;
|
var channel, parsed0;
|
||||||
@ -373,12 +378,14 @@ define([
|
|||||||
|| mySyncData.profile !== myData.profile
|
|| mySyncData.profile !== myData.profile
|
||||||
|| mySyncData.avatar !== myData.avatar) {
|
|| mySyncData.avatar !== myData.avatar) {
|
||||||
delete myData.channel;
|
delete myData.channel;
|
||||||
Object.keys(channels).forEach(function (chan) {
|
Object.keys(friends).forEach(function (curve) {
|
||||||
var channel = channels[chan];
|
var friend = friends[curve];
|
||||||
|
var chan = friend.channel;
|
||||||
|
if (friend.notifications) { return; }
|
||||||
|
if (!chan) { return; }
|
||||||
|
|
||||||
if (!channel) {
|
var channel = channels[chan];
|
||||||
return void console.error('NO_SUCH_CHANNEL');
|
if (!channel) { return; }
|
||||||
}
|
|
||||||
if (channel.readOnly) { return; }
|
if (channel.readOnly) { return; }
|
||||||
|
|
||||||
var msg = [Types.update, myData.curvePublic, +new Date(), myData];
|
var msg = [Types.update, myData.curvePublic, +new Date(), myData];
|
||||||
@ -396,7 +403,6 @@ define([
|
|||||||
info: myData,
|
info: myData,
|
||||||
types: ['displayName', 'profile', 'avatar'],
|
types: ['displayName', 'profile', 'avatar'],
|
||||||
});
|
});
|
||||||
friends.me = myData;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -153,6 +153,9 @@ define([
|
|||||||
Object.keys(msg.content).forEach(function (key) {
|
Object.keys(msg.content).forEach(function (key) {
|
||||||
friend[key] = msg.content[key];
|
friend[key] = msg.content[key];
|
||||||
});
|
});
|
||||||
|
if (ctx.store.messenger) {
|
||||||
|
ctx.store.messenger.onFriendUpdate(curve, friend);
|
||||||
|
}
|
||||||
ctx.updateMetadata();
|
ctx.updateMetadata();
|
||||||
cb(true);
|
cb(true);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user