Make the friends list from the share modal reusable

This commit is contained in:
yflory
2019-08-28 15:29:38 +02:00
parent 28b2341f2c
commit f6762f7c01
8 changed files with 256 additions and 126 deletions

View File

@@ -714,10 +714,10 @@ module.exports.create = function (cfg) {
// If it is, remove it from memory and broadcast a message to its members
const onChannelMetadataChanged = function (ctx, channel, metadata) {
Log.debug('SET_METADATA_CACHE', 'Test'); // XXX
if (channel && metadata_cache[channel]) {
Log.debug('SET_METADATA_CACHE', 'Channel '+ channel +', metadata: '+ JSON.stringify(metadata));
if (channel && metadata_cache[channel] && typeof (metadata) === "object") {
Log.silly('SET_METADATA_CACHE', 'Channel '+ channel +', metadata: '+ JSON.stringify(metadata));
metadata_cache[channel] = metadata;
historyKeeperBroadcast(ctx, channel, metadata);
}
};
@@ -988,7 +988,7 @@ module.exports.create = function (cfg) {
// make sure we update our cache of metadata
// or at least invalidate it and force other mechanisms to recompute its state
// 'output' could be the new state as computed by rpc
onChannelMetadataChanged(ctx, msg[4], output[1]);
onChannelMetadataChanged(ctx, msg[4].channel, output[1]);
}
sendMsg(ctx, user, [0, HISTORY_KEEPER_ID, 'MSG', user.id, JSON.stringify([parsed[0]].concat(output))]);