Improve friend request process and UI

This commit is contained in:
yflory
2019-05-22 18:03:52 +02:00
parent 38f8535dd5
commit 9cb1a059f2
11 changed files with 257 additions and 66 deletions

View File

@@ -392,10 +392,17 @@ define([
var friendRequests = {};
funcs.addFriendRequest = function (data) {
var curve = Util.find(data, ['content', 'msg', 'author']);
console.log(data);
console.log(curve);
friendRequests[curve] = data;
};
funcs.removeFriendRequest = function (hash) {
Object.keys(friendRequests).some(function (curve) {
var h = Util.find(friendRequests[curve], ['content', 'hash']);
if (h === hash) {
delete friendRequests[curve];
return true;
}
});
};
funcs.getFriendRequests = function () {
return JSON.parse(JSON.stringify(friendRequests));
};