archive files deleted by 'removeOwnedChannel' if the admin has configured that behaviour

This commit is contained in:
ansuz 2019-06-13 16:44:27 +02:00
parent 6aa6b706a4
commit a2c8ec963c
1 changed files with 14 additions and 3 deletions

17
rpc.js
View File

@ -902,9 +902,19 @@ var removeOwnedChannel = function (Env, channelId, unsafeKey, cb) {
return void cb('INSUFFICIENT_PERMISSIONS');
}
// FIXME COLDSTORAGE
// XXX check if 'config.retainData' is set to true
// if so, use msgStore.archiveChannel instead
// if the admin has configured data retention...
// temporarily archive the file instead of removing it
if (Env.retainData) {
return void Env.msgStore.archiveChannel(channelId, function (e) {
Log.info('ARCHIVAL_CHANNEL_BY_OWNER_RPC', {
unsafeKey: unsafeKey,
channelId: channelId,
status: e? String(e): 'SUCCESS',
});
cb(e);
});
}
return void Env.msgStore.removeChannel(channelId, function (e) {
Log.info('DELETION_CHANNEL_BY_OWNER_RPC', {
unsafeKey: unsafeKey,
@ -1651,6 +1661,7 @@ RPC.create = function (
};
var Env = {
retainData: config.retainData || false,
defaultStorageLimit: config.defaultStorageLimit,
maxUploadSize: config.maxUploadSize || (20 * 1024 * 1024),
Sessions: {},