selft to this
This commit is contained in:
parent
bcad6dbe22
commit
e85f4e4129
@ -298,8 +298,6 @@ TemplateMaps.prototype.delTemplate = function(owner, tpl_id, callback) {
|
|||||||
//
|
//
|
||||||
TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback) {
|
TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback) {
|
||||||
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
template = templateDefaults(template);
|
template = templateDefaults(template);
|
||||||
|
|
||||||
var invalidError = this._checkInvalidTemplate(template);
|
var invalidError = this._checkInvalidTemplate(template);
|
||||||
@ -319,7 +317,7 @@ TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback)
|
|||||||
var previousTemplate = null;
|
var previousTemplate = null;
|
||||||
|
|
||||||
|
|
||||||
self._redisCmd('HGET', [ userTemplatesKey, tpl_id ], (err, _currentTemplate) => {
|
this._redisCmd('HGET', [ userTemplatesKey, tpl_id ], (err, _currentTemplate) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
@ -329,7 +327,7 @@ TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback)
|
|||||||
}
|
}
|
||||||
|
|
||||||
previousTemplate = _currentTemplate;
|
previousTemplate = _currentTemplate;
|
||||||
self._redisCmd('HSET', [ userTemplatesKey, templateName, JSON.stringify(template) ], (err, didSetNewField) => {
|
this._redisCmd('HSET', [ userTemplatesKey, templateName, JSON.stringify(template) ], (err, didSetNewField) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
@ -338,8 +336,8 @@ TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback)
|
|||||||
debug('New template created on update operation');
|
debug('New template created on update operation');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.fingerPrint(JSON.parse(previousTemplate)) !== self.fingerPrint(template)) {
|
if (this.fingerPrint(JSON.parse(previousTemplate)) !== this.fingerPrint(template)) {
|
||||||
self.emit('update', owner, templateName, template);
|
this.emit('update', owner, templateName, template);
|
||||||
}
|
}
|
||||||
|
|
||||||
return callback(err, template);
|
return callback(err, template);
|
||||||
|
Loading…
Reference in New Issue
Block a user