|
|
@ -54,7 +54,8 @@ Channel.clearOwnedChannel = function (Env, safeKey, channelId, cb, Server) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var archiveOwnedChannel = function (Env, safeKey, channelId, _cb, Server) {
|
|
|
|
var archiveOwnedChannel = function (Env, safeKey, channelId, __cb, Server) {
|
|
|
|
|
|
|
|
var _cb = Util.once(Util.mkAsync(__cb));
|
|
|
|
var unsafeKey = Util.unescapeKeyCharacters(safeKey);
|
|
|
|
var unsafeKey = Util.unescapeKeyCharacters(safeKey);
|
|
|
|
nThen(function (w) {
|
|
|
|
nThen(function (w) {
|
|
|
|
// confirm that the channel exists before worrying about whether
|
|
|
|
// confirm that the channel exists before worrying about whether
|
|
|
@ -160,7 +161,10 @@ Channel.trimHistory = function (Env, safeKey, data, cb) {
|
|
|
|
|
|
|
|
|
|
|
|
nThen(function (w) {
|
|
|
|
nThen(function (w) {
|
|
|
|
Metadata.getMetadataRaw(Env, channelId, w(function (err, metadata) {
|
|
|
|
Metadata.getMetadataRaw(Env, channelId, w(function (err, metadata) {
|
|
|
|
if (err) { return void cb(err); }
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
w.abort();
|
|
|
|
|
|
|
|
return void cb(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!Core.hasOwners(metadata)) {
|
|
|
|
if (!Core.hasOwners(metadata)) {
|
|
|
|
w.abort();
|
|
|
|
w.abort();
|
|
|
|
return void cb('E_NO_OWNERS');
|
|
|
|
return void cb('E_NO_OWNERS');
|
|
|
@ -173,6 +177,11 @@ Channel.trimHistory = function (Env, safeKey, data, cb) {
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}).nThen(function () {
|
|
|
|
}).nThen(function () {
|
|
|
|
Env.msgStore.trimChannel(channelId, hash, function (err) {
|
|
|
|
Env.msgStore.trimChannel(channelId, hash, function (err) {
|
|
|
|
|
|
|
|
Env.Log.info('HK_TRIM_HISTORY', {
|
|
|
|
|
|
|
|
unsafeKey: unsafeKey,
|
|
|
|
|
|
|
|
channelId: channelId,
|
|
|
|
|
|
|
|
status: err? String(err): 'SUCCESS',
|
|
|
|
|
|
|
|
});
|
|
|
|
if (err) { return void cb(err); }
|
|
|
|
if (err) { return void cb(err); }
|
|
|
|
// clear historyKeeper's cache for this channel
|
|
|
|
// clear historyKeeper's cache for this channel
|
|
|
|
Env.historyKeeper.channelClose(channelId);
|
|
|
|
Env.historyKeeper.channelClose(channelId);
|
|
|
|