lint compliance

pull/1/head
ansuz 8 years ago
parent 575d4612f9
commit a756faf818

@ -686,7 +686,7 @@ var clearOwnedChannel = function (Env, channelId, unsafeKey, cb) {
} }
Env.msgStore.getChannelMetadata(channelId, function (e, metadata) { Env.msgStore.getChannelMetadata(channelId, function (e, metadata) {
if (e) { return Respond(e); } if (e) { return cb(e); }
if (!(metadata && Array.isArray(metadata.owners))) { return void cb('E_NO_OWNERS'); } if (!(metadata && Array.isArray(metadata.owners))) { return void cb('E_NO_OWNERS'); }
// Confirm that the channel is owned by the user is question // Confirm that the channel is owned by the user is question
if (metadata.owners.indexOf(unsafeKey) === -1) { if (metadata.owners.indexOf(unsafeKey) === -1) {

@ -44,6 +44,18 @@ var getChannelMetadata = function (Env, channelId, cb) {
getMetadataAtPath(Env, path, cb); getMetadataAtPath(Env, path, cb);
}; };
var closeChannel = function (env, channelName, cb) {
if (!env.channels[channelName]) { return; }
try {
env.channels[channelName].writeStream.close();
delete env.channels[channelName];
env.openFiles--;
cb();
} catch (err) {
cb(err);
}
};
var clearChannel = function (Env, channelId, cb) { var clearChannel = function (Env, channelId, cb) {
var path = mkPath(Env, channelId); var path = mkPath(Env, channelId);
getMetadataAtPath(Env, path, function (e, metadata) { getMetadataAtPath(Env, path, function (e, metadata) {
@ -112,18 +124,6 @@ var removeChannel = function (env, channelName, cb) {
Fs.unlink(filename, cb); Fs.unlink(filename, cb);
}; };
var closeChannel = function (env, channelName, cb) {
if (!env.channels[channelName]) { return; }
try {
env.channels[channelName].writeStream.close();
delete env.channels[channelName];
env.openFiles--;
cb();
} catch (err) {
cb(err);
}
};
var flushUnusedChannels = function (env, cb, frame) { var flushUnusedChannels = function (env, cb, frame) {
var currentTime = +new Date(); var currentTime = +new Date();

Loading…
Cancel
Save