Fix bug (deletion if lastEdit timestamp is null) + more info in log
This commit is contained in:
parent
0c969d386f
commit
63e05ddb66
1 changed files with 39 additions and 37 deletions
|
@ -35,6 +35,7 @@ exports.handleMessage = function(hook_name, context, cb) {
|
||||||
if (pad.getHeadRevisionNumber() !== 0) {
|
if (pad.getHeadRevisionNumber() !== 0) {
|
||||||
|
|
||||||
pad.getLastEdit(function(callback, timestamp) {
|
pad.getLastEdit(function(callback, timestamp) {
|
||||||
|
if (timestamp !== undefined && timestamp !== null) {
|
||||||
var currentTime = (new Date).getTime();
|
var currentTime = (new Date).getTime();
|
||||||
|
|
||||||
// Are we over delay?
|
// Are we over delay?
|
||||||
|
@ -42,7 +43,7 @@ exports.handleMessage = function(hook_name, context, cb) {
|
||||||
|
|
||||||
// Remove pad
|
// Remove pad
|
||||||
padManager.removePad(padId);
|
padManager.removePad(padId);
|
||||||
console.info('Pad '+padId+' deleted since expired (delay: '+delay+' seconds).');
|
console.info('Pad '+padId+' deleted since expired (delay: '+delay+' seconds, last edition: '+timestamp+').');
|
||||||
|
|
||||||
// Create new pad with an explanation
|
// Create new pad with an explanation
|
||||||
padManager.getPad(padId, replaceText, function() {
|
padManager.getPad(padId, replaceText, function() {
|
||||||
|
@ -76,6 +77,7 @@ exports.handleMessage = function(hook_name, context, cb) {
|
||||||
console.info('Nothing to do with '+padId+' (not expired)');
|
console.info('Nothing to do with '+padId+' (not expired)');
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.info('New or empty pad '+padId);
|
console.info('New or empty pad '+padId);
|
||||||
|
|
Loading…
Reference in a new issue