From dfe404fefbbbdd630c03380b6df2d1ec59ce9a7e Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Mon, 25 Dec 2017 22:15:37 +0100 Subject: [PATCH] Fix "Pad could not be found" error when saving settings without change --- server/database/pad.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server/database/pad.js b/server/database/pad.js index 5a057d44..af7fcb82 100644 --- a/server/database/pad.js +++ b/server/database/pad.js @@ -135,12 +135,11 @@ module.exports = function(Database) { } }, - update: (validateRead, validateWrite, validateAdmin) => { - return this._conn.model("Pad").update(data, { where: { id: padId } }).then(res => { - if(res[0] == 0) - throw new Error("Pad " + padId + " could not be found."); - return res; - }); + update: (oldData, validateRead, validateWrite, validateAdmin) => { + if(!oldData) + throw new Error("Pad " + padId + " could not be found."); + + return this._conn.model("Pad").update(data, { where: { id: padId } }); }, newData: (update) => this.getPadData(data.id || padId),