Serverside metadata update

This commit is contained in:
yflory
2019-08-28 12:40:35 +02:00
parent 113a362724
commit 28b2341f2c
4 changed files with 68 additions and 3 deletions

View File

@@ -713,8 +713,12 @@ module.exports.create = function (cfg) {
// Check if the selected channel is expired
// If it is, remove it from memory and broadcast a message to its members
const onChannelMetadataChanged = function (ctx, channel) {
channel = channel;
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));
metadata_cache[channel] = metadata;
}
};
/* checkExpired
@@ -984,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]);
onChannelMetadataChanged(ctx, msg[4], output[1]);
}
sendMsg(ctx, user, [0, HISTORY_KEEPER_ID, 'MSG', user.id, JSON.stringify([parsed[0]].concat(output))]);