Browse Source

fix: carried ignoreWebhook from body to query

pull/1565/head
mertmit 3 years ago
parent
commit
1e71931f47
  1. 2
      packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue
  2. 6
      packages/nc-gui/plugins/ncApis/gqlApi.js
  3. 5
      packages/nc-gui/plugins/ncApis/restApi.js
  4. 4
      packages/nocodb/src/lib/noco/common/BaseModel.ts

2
packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue

@ -1097,7 +1097,7 @@ export default {
return return
} }
// return if there is no change // 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 return
} }
if(saved) this.$set(this.data[row], 'lastSave', oldRow[column._cn]); if(saved) this.$set(this.data[row], 'lastSave', oldRow[column._cn]);

6
packages/nc-gui/plugins/ncApis/gqlApi.js

@ -183,8 +183,10 @@ export default class GqlApi {
}`, }`,
variables: { variables: {
id, data id, data
}, }
_ignoreWebhook: !cellSaved },
{
params: { ignoreWebhook: !cellSaved }
}) })
const colName = Object.keys(data)[0] const colName = Object.keys(data)[0]

5
packages/nc-gui/plugins/ncApis/restApi.js

@ -65,13 +65,12 @@ export default class RestApi {
} }
async update(id, data, oldData, cellSaved = false) { async update(id, data, oldData, cellSaved = false) {
data._ignoreWebhook = !cellSaved
const res = await this.$axios({ const res = await this.$axios({
method: 'put', method: 'put',
url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${encodeURIComponent(id)}`, url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${encodeURIComponent(id)}`,
data data,
params: { ignoreWebhook: !cellSaved }
}) })
return res.data return res.data
} }

4
packages/nocodb/src/lib/noco/common/BaseModel.ts

@ -49,7 +49,7 @@ class BaseModel<T extends BaseApiBuilder<any>> extends BaseModelSql {
public async beforeUpdate(data: any, _trx: any, req): Promise<void> { public async beforeUpdate(data: any, _trx: any, req): Promise<void> {
req = req || {}; req = req || {};
req['oldData'] = await this.readByPk(req['params'].id); 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<void> { public async afterUpdate(data: any, _trx: any, req): Promise<void> {
@ -74,7 +74,7 @@ class BaseModel<T extends BaseApiBuilder<any>> extends BaseModelSql {
user: req.user?.email 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) { private _updateAuditDescription(id, oldData: any, data: any) {

Loading…
Cancel
Save