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) {
|
||||
|
||||
var self = this;
|
||||
|
||||
template = templateDefaults(template);
|
||||
|
||||
var invalidError = this._checkInvalidTemplate(template);
|
||||
@ -319,7 +317,7 @@ TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback)
|
||||
var previousTemplate = null;
|
||||
|
||||
|
||||
self._redisCmd('HGET', [ userTemplatesKey, tpl_id ], (err, _currentTemplate) => {
|
||||
this._redisCmd('HGET', [ userTemplatesKey, tpl_id ], (err, _currentTemplate) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@ -329,7 +327,7 @@ TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback)
|
||||
}
|
||||
|
||||
previousTemplate = _currentTemplate;
|
||||
self._redisCmd('HSET', [ userTemplatesKey, templateName, JSON.stringify(template) ], (err, didSetNewField) => {
|
||||
this._redisCmd('HSET', [ userTemplatesKey, templateName, JSON.stringify(template) ], (err, didSetNewField) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
@ -338,8 +336,8 @@ TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback)
|
||||
debug('New template created on update operation');
|
||||
}
|
||||
|
||||
if (self.fingerPrint(JSON.parse(previousTemplate)) !== self.fingerPrint(template)) {
|
||||
self.emit('update', owner, templateName, template);
|
||||
if (this.fingerPrint(JSON.parse(previousTemplate)) !== this.fingerPrint(template)) {
|
||||
this.emit('update', owner, templateName, template);
|
||||
}
|
||||
|
||||
return callback(err, template);
|
||||
|
Loading…
Reference in New Issue
Block a user