Update the profile page when receiving a answer for a friend request

This commit is contained in:
yflory 2019-05-27 16:03:10 +02:00
parent 36aa07adab
commit 6370c0eeae
2 changed files with 8 additions and 0 deletions

View File

@ -51,6 +51,8 @@ define([
delete ctx.store.proxy.friends_pending[data.msg.author]; delete ctx.store.proxy.friends_pending[data.msg.author];
ctx.updateMetadata(); ctx.updateMetadata();
if (friendRequestDeclined[data.msg.author]) { return; } if (friendRequestDeclined[data.msg.author]) { return; }
// If you have a profile page open, update it
if (ctx.store.modules['profile']) { ctx.store.modules['profile'].update(); }
box.sendMessage({ box.sendMessage({
type: 'FRIEND_REQUEST_DECLINED', type: 'FRIEND_REQUEST_DECLINED',
content: { content: {
@ -95,6 +97,9 @@ define([
ctx.store.messenger.onFriendAdded(data.msg.content); ctx.store.messenger.onFriendAdded(data.msg.content);
} }
ctx.updateMetadata(); ctx.updateMetadata();
if (friendRequestAccepted[data.msg.author]) { return; }
// If you have a profile page open, update it
if (ctx.store.modules['profile']) { ctx.store.modules['profile'].update(); }
// Display the "accepted" state in the UI // Display the "accepted" state in the UI
box.sendMessage({ box.sendMessage({
type: 'FRIEND_REQUEST_ACCEPTED', type: 'FRIEND_REQUEST_ACCEPTED',

View File

@ -134,6 +134,9 @@ define([
profile.removeClient = function (clientId) { profile.removeClient = function (clientId) {
removeClient(ctx, clientId); removeClient(ctx, clientId);
}; };
profile.update = function () {
ctx.emit('UPDATE', ctx.listmap.proxy, ctx.clients);
};
profile.execCommand = function (clientId, obj, cb) { profile.execCommand = function (clientId, obj, cb) {
console.log(obj); console.log(obj);
var cmd = obj.cmd; var cmd = obj.cmd;