style details

This commit is contained in:
Simon Martín 2018-08-01 15:40:40 +02:00
parent e85f4e4129
commit 2a2f703abc

View File

@ -301,23 +301,20 @@ TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback)
template = templateDefaults(template);
var invalidError = this._checkInvalidTemplate(template);
if ( invalidError ) {
if (invalidError) {
return callback(invalidError);
}
var templateName = template.name;
if ( tpl_id !== templateName ) {
if (tpl_id !== templateName) {
return callback(new Error("Cannot update name of a map template ('" + tpl_id + "' != '" + templateName + "')"));
}
var userTemplatesKey = this.key_usr_tpl({ owner:owner });
var userTemplatesKey = this.key_usr_tpl({ owner });
var previousTemplate = null;
this._redisCmd('HGET', [ userTemplatesKey, tpl_id ], (err, _currentTemplate) => {
this._redisCmd('HGET', [userTemplatesKey, tpl_id], (err, _currentTemplate) => {
if (err) {
return callback(err);
}
@ -327,7 +324,7 @@ TemplateMaps.prototype.updTemplate = function(owner, tpl_id, template, callback)
}
previousTemplate = _currentTemplate;
this._redisCmd('HSET', [ userTemplatesKey, templateName, JSON.stringify(template) ], (err, didSetNewField) => {
this._redisCmd('HSET', [userTemplatesKey, templateName, JSON.stringify(template)], (err, didSetNewField) => {
if (err) {
return callback(err);
}