merge latest staging
This commit is contained in:
commit
b82c0a420a
@ -836,7 +836,7 @@ module.exports.create = function (cfg) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// write tasks
|
// write tasks
|
||||||
if(tasks && metadata.expire && metadata.expire === 'number') {
|
if(tasks && metadata.expire && typeof(metadata.expire) === 'number') {
|
||||||
// the fun part...
|
// the fun part...
|
||||||
// the user has said they want this pad to expire at some point
|
// the user has said they want this pad to expire at some point
|
||||||
tasks.write(metadata.expire, "EXPIRE", [ channelName ], function (err) {
|
tasks.write(metadata.expire, "EXPIRE", [ channelName ], function (err) {
|
||||||
|
|||||||
@ -505,9 +505,13 @@ var archiveChannel = function (env, channelName, cb) {
|
|||||||
nThen(function (w) {
|
nThen(function (w) {
|
||||||
// move the channel log and abort if anything goes wrong
|
// move the channel log and abort if anything goes wrong
|
||||||
Fse.move(currentPath, archivePath, { overwrite: true }, w(function (err) {
|
Fse.move(currentPath, archivePath, { overwrite: true }, w(function (err) {
|
||||||
if (!err) { return; }
|
if (err) {
|
||||||
|
// proceed to the next block to remove metadata even if there's no channel
|
||||||
|
if (err.code === 'ENOENT') { return; }
|
||||||
|
// abort and callback for other types of errors
|
||||||
w.abort();
|
w.abort();
|
||||||
cb(err);
|
return void cb(err);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}).nThen(function (w) {
|
}).nThen(function (w) {
|
||||||
// archive the dedicated metadata channel
|
// archive the dedicated metadata channel
|
||||||
@ -623,7 +627,7 @@ var flushUnusedChannels = function (env, cb, frame) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* channelBytes
|
/* channelBytes
|
||||||
calls back with the size (in bytes) of a channel and its metadata
|
calls back with an error or the size (in bytes) of a channel and its metadata
|
||||||
*/
|
*/
|
||||||
var channelBytes = function (env, chanName, cb) {
|
var channelBytes = function (env, chanName, cb) {
|
||||||
var channelPath = mkPath(env, chanName);
|
var channelPath = mkPath(env, chanName);
|
||||||
@ -647,7 +651,6 @@ var channelBytes = function (env, chanName, cb) {
|
|||||||
return void CB(err);
|
return void CB(err);
|
||||||
}
|
}
|
||||||
dataSize = stats.size;
|
dataSize = stats.size;
|
||||||
CB(undefined, stats.size);
|
|
||||||
}));
|
}));
|
||||||
}).nThen(function () {
|
}).nThen(function () {
|
||||||
CB(void 0, channelSize + dataSize);
|
CB(void 0, channelSize + dataSize);
|
||||||
|
|||||||
@ -314,11 +314,21 @@ define([
|
|||||||
var newPad = false;
|
var newPad = false;
|
||||||
if (newContentStr === '') { newPad = true; }
|
if (newContentStr === '') { newPad = true; }
|
||||||
|
|
||||||
|
var privateDat = cpNfInner.metadataMgr.getPrivateData();
|
||||||
|
var type = privateDat.app;
|
||||||
|
|
||||||
// contentUpdate may be async so we need an nthen here
|
// contentUpdate may be async so we need an nthen here
|
||||||
nThen(function (waitFor) {
|
nThen(function (waitFor) {
|
||||||
if (!newPad) {
|
if (!newPad) {
|
||||||
var newContent = JSON.parse(newContentStr);
|
var newContent = JSON.parse(newContentStr);
|
||||||
cpNfInner.metadataMgr.updateMetadata(extractMetadata(newContent));
|
var metadata = extractMetadata(newContent);
|
||||||
|
if (metadata && typeof(metadata.type) !== 'undefined' && metadata.type !== type) {
|
||||||
|
var errorText = Messages.typeError;
|
||||||
|
UI.errorLoadingScreen(errorText);
|
||||||
|
waitFor.abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cpNfInner.metadataMgr.updateMetadata(metadata);
|
||||||
newContent = normalize(newContent);
|
newContent = normalize(newContent);
|
||||||
contentUpdate(newContent, waitFor);
|
contentUpdate(newContent, waitFor);
|
||||||
} else {
|
} else {
|
||||||
@ -356,8 +366,6 @@ define([
|
|||||||
|
|
||||||
UI.removeLoadingScreen(emitResize);
|
UI.removeLoadingScreen(emitResize);
|
||||||
|
|
||||||
var privateDat = cpNfInner.metadataMgr.getPrivateData();
|
|
||||||
var type = privateDat.app;
|
|
||||||
if (AppConfig.textAnalyzer && textContentGetter) {
|
if (AppConfig.textAnalyzer && textContentGetter) {
|
||||||
AppConfig.textAnalyzer(textContentGetter, privateDat.channel);
|
AppConfig.textAnalyzer(textContentGetter, privateDat.channel);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user