Browse Source

fix: hotfix reverting breaking changes

-changed variable name to _ignoreWebhook
-if _ignoreWebhook not present fire the webhook as intended
pull/1565/head
mertmit 2 years ago
parent
commit
3d232572b6
  1. 2
      packages/nc-gui/plugins/ncApis/gqlApi.js
  2. 2
      packages/nc-gui/plugins/ncApis/restApi.js
  3. 4
      packages/nocodb/src/lib/noco/common/BaseModel.ts

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

@ -184,7 +184,7 @@ export default class GqlApi {
variables: {
id, data
},
_cellSaved: cellSaved
_ignoreWebhook: !cellSaved
})
const colName = Object.keys(data)[0]

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

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

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> {
req = req || {};
req['oldData'] = await this.readByPk(req['params'].id);
if(req.body?._cellSaved) await this.handleHooks('before.update', data, req);
if(!req.body?._ignoreWebhook) await this.handleHooks('before.update', data, req);
}
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
}
)
if(req.body?._cellSaved) await this.handleHooks('after.update', data, req);
if(!req.body?._ignoreWebhook) await this.handleHooks('after.update', data, req);
}
private _updateAuditDescription(id, oldData: any, data: any) {

Loading…
Cancel
Save