migrate profile to include edKey. don't propose connecting to users with whom you are already friends

pull/1/head
ansuz 8 years ago
parent b295aaa6c7
commit 0340b45f2c

@ -158,14 +158,22 @@ define([
}; };
*/ */
var isFriend = function (proxy, edKey) {
var friends = Cryptpad.find(proxy, ['friends']);
return typeof(edKey) === 'string' && friends && (edKey in friends);
};
var addCreateInviteLinkButton = function ($container) { var addCreateInviteLinkButton = function ($container) {
var obj = APP.lm.proxy; var obj = APP.lm.proxy;
var proxy = Cryptpad.getProxy(); var proxy = Cryptpad.getProxy();
var userViewHash = Cryptpad.find(proxy, ['profile', 'view']); var userViewHash = Cryptpad.find(proxy, ['profile', 'view']);
if (!APP.readOnly || !obj.curveKey || userViewHash === window.location.hash.slice(1)) { var edKey = obj.edKey;
console.log("edit mode or missing curve key, or you're viewing your own profile"); var curveKey = obj.curveKey;
if (!APP.readOnly || !curveKey || !edKey || userViewHash === window.location.hash.slice(1) || isFriend(proxy, edKey)) {
//console.log("edit mode or missing curve key, or you're viewing your own profile");
return; return;
} }
@ -431,6 +439,7 @@ define([
var pubKeys = Cryptpad.getPublicKeys(); var pubKeys = Cryptpad.getPublicKeys();
if (pubKeys && pubKeys.curve) { if (pubKeys && pubKeys.curve) {
obj.curveKey = pubKeys.curve; obj.curveKey = pubKeys.curve;
obj.edKey = pubKeys.ed;
} }
} }

Loading…
Cancel
Save