Fix "Pad could not be found" error when saving settings without change

pull/108/head
Candid Dauth 2017-12-25 22:15:37 +01:00
rodzic b441169646
commit dfe404fefb
1 zmienionych plików z 5 dodań i 6 usunięć

Wyświetl plik

@ -135,12 +135,11 @@ module.exports = function(Database) {
} }
}, },
update: (validateRead, validateWrite, validateAdmin) => { update: (oldData, validateRead, validateWrite, validateAdmin) => {
return this._conn.model("Pad").update(data, { where: { id: padId } }).then(res => { if(!oldData)
if(res[0] == 0) throw new Error("Pad " + padId + " could not be found.");
throw new Error("Pad " + padId + " could not be found.");
return res; return this._conn.model("Pad").update(data, { where: { id: padId } });
});
}, },
newData: (update) => this.getPadData(data.id || padId), newData: (update) => this.getPadData(data.id || padId),