Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

better ee hand oss handling

Fendy Heryanto078fc6c734f7
diff --git a/packages/nocodb/src/utils/view-webhook-manager.ts b/packages/nocodb/src/utils/view-webhook-manager.ts
index d6f1fa8ddb..8b12a840e8 100644
--- a/packages/nocodb/src/utils/view-webhook-manager.ts
+++ b/packages/nocodb/src/utils/view-webhook-manager.ts
@@ -1,16 +1,11 @@
-import {
- objRemoveEmptyStringProps,
- WebhookActions,
- WebhookEvents,
-} from 'nocodb-sdk';
-import type { ModelWebhookManager } from '~/utils/model-webhook-manager';
+import { WebhookActions } from 'nocodb-sdk';
import type { NcContext, NcRequest } from 'nocodb-sdk';
-import type { IViewsV3Service } from '~/services/v3/views-v3.types';
import type { MetaService } from '~/meta/meta.service';
import type { Model } from '~/models';
-import Noco from '~/Noco';
+import type { IViewsV3Service } from '~/services/v3/views-v3.types';
+import type { ModelWebhookManager } from '~/utils/model-webhook-manager';
import { NcError } from '~/helpers/ncError';
-import { HANDLE_WEBHOOK } from '~/services/hook-handler.service';
+import Noco from '~/Noco';
export class ViewWebhookManagerBuilder {
constructor(
@@ -69,11 +64,6 @@ export class ViewWebhookManagerBuilder {
`Need to call 'withModel' before running 'forUpdate'`,
);
}
- if (!this.oldView) {
- NcError.get(this.context).internalServerError(
- `Need to call 'withView' before running 'forUpdate'`,
- );
- }
return new ViewWebhookManager(this.context, {
action: WebhookActions.UPDATE,
modelId: this.modelId!,
@@ -88,11 +78,6 @@ export class ViewWebhookManagerBuilder {
`Need to call 'withModel' before running 'forDelete'`,
);
}
- if (!this.oldView) {
- NcError.get(this.context).internalServerError(
- `Need to call 'withView' before running 'forDelete'`,
- );
- }
return new ViewWebhookManager(
this.context,
{
@@ -142,43 +127,5 @@ export class ViewWebhookManager {
getViewId() {
return (this.params.oldView?.id ?? this.params.newView?.id) as string;
}
-
- isOldAndNewEqual(oldView, newView) {
- const compareOld = {
- ...oldView,
- created_at: null,
- updated_at: null,
- };
- const compareNew = {
- ...newView,
- created_at: null,
- updated_at: null,
- };
- return (
- JSON.stringify(objRemoveEmptyStringProps(compareOld)) ===
- JSON.stringify(objRemoveEmptyStringProps(compareNew))
- );
- }
-
- emit() {
- // if modelWebhookManager exists, we do not emit
- if (!this.emitted && !this.params.modelWebhookManager) {
- // if no changes on the view, do not emit
- if (
- this.params.action === WebhookActions.UPDATE &&
- this.isOldAndNewEqual(this.params.oldView, this.params.newView)
- ) {
- return;
- }
- Noco.eventEmitter.emit(HANDLE_WEBHOOK, {
- context: this.context,
- hookName: `${WebhookEvents.VIEW}.${this.params.action}`,
- prevData: this.params.oldView,
- newData: this.params.newView,
- user: this.context.user,
- modelId: this.params.modelId,
- });
- this.emitted = true;
- }
- }
+ emit() {}
}