From 1e71931f47fce9043e4c53d30f6054a3fea0111d Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 1 Apr 2022 19:13:30 +0300 Subject: [PATCH] fix: carried ignoreWebhook from body to query --- .../components/project/spreadsheet/rowsXcDataTable.vue | 2 +- packages/nc-gui/plugins/ncApis/gqlApi.js | 6 ++++-- packages/nc-gui/plugins/ncApis/restApi.js | 5 ++--- packages/nocodb/src/lib/noco/common/BaseModel.ts | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue index 4700ddfdec..fa71bb30aa 100644 --- a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue +++ b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue @@ -1097,7 +1097,7 @@ export default { return } // return if there is no change - if (oldRow[column._cn] === rowObj[column._cn] && ((lastSave || null) === rowObj[column._cn])) { + if (oldRow[column._cn] === rowObj[column._cn] && ((lastSave || rowObj[column._cn]) == rowObj[column._cn])) { return } if(saved) this.$set(this.data[row], 'lastSave', oldRow[column._cn]); diff --git a/packages/nc-gui/plugins/ncApis/gqlApi.js b/packages/nc-gui/plugins/ncApis/gqlApi.js index 66ebafeb06..9da22b1f8d 100644 --- a/packages/nc-gui/plugins/ncApis/gqlApi.js +++ b/packages/nc-gui/plugins/ncApis/gqlApi.js @@ -183,8 +183,10 @@ export default class GqlApi { }`, variables: { id, data - }, - _ignoreWebhook: !cellSaved + } + }, + { + params: { ignoreWebhook: !cellSaved } }) const colName = Object.keys(data)[0] diff --git a/packages/nc-gui/plugins/ncApis/restApi.js b/packages/nc-gui/plugins/ncApis/restApi.js index 0d6dc09981..3bd81f5708 100644 --- a/packages/nc-gui/plugins/ncApis/restApi.js +++ b/packages/nc-gui/plugins/ncApis/restApi.js @@ -65,13 +65,12 @@ export default class RestApi { } async update(id, data, oldData, cellSaved = false) { - data._ignoreWebhook = !cellSaved const res = await this.$axios({ method: 'put', url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${encodeURIComponent(id)}`, - data + data, + params: { ignoreWebhook: !cellSaved } }) - return res.data } diff --git a/packages/nocodb/src/lib/noco/common/BaseModel.ts b/packages/nocodb/src/lib/noco/common/BaseModel.ts index 7ce7e5736a..abb87fc9e7 100644 --- a/packages/nocodb/src/lib/noco/common/BaseModel.ts +++ b/packages/nocodb/src/lib/noco/common/BaseModel.ts @@ -49,7 +49,7 @@ class BaseModel> extends BaseModelSql { public async beforeUpdate(data: any, _trx: any, req): Promise { req = req || {}; req['oldData'] = await this.readByPk(req['params'].id); - if(!req.body?._ignoreWebhook) await this.handleHooks('before.update', data, req); + if(req.query?.ignoreWebhook === undefined || req.query?.ignoreWebhook == 'false') await this.handleHooks('before.update', data, req); } public async afterUpdate(data: any, _trx: any, req): Promise { @@ -74,7 +74,7 @@ class BaseModel> extends BaseModelSql { user: req.user?.email } ) - if(!req.body?._ignoreWebhook) await this.handleHooks('after.update', data, req); + if(req.query?.ignoreWebhook === undefined || req.query?.ignoreWebhook == 'false') await this.handleHooks('after.update', data, req); } private _updateAuditDescription(id, oldData: any, data: any) {