Skip to content

Commit

Permalink
fix: use destructured object on some functions (#1941)
Browse files Browse the repository at this point in the history
Fixes NAN-675

In the process of migration to logs v2, I need to pass the new ctx to a
lot of functions and because we use classic parameters everywhere it's a
bit messy especially when there are some optional parameters too.
I didn't modified everything to avoid a too large PR.

- Use destructured object parameters where it would be painful to add a
new param
  • Loading branch information
bodinsamuel committed Apr 3, 2024
1 parent ffc9fe5 commit e3f45e1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions packages/shared/lib/services/notification/slack.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ class SlackService {
payload,
originalActivityLogId,
environment_id,
logCtx,
slackNotificationStatus.id,
slackNotificationStatus.admin_slack_timestamp
);
Expand Down Expand Up @@ -406,21 +405,16 @@ class SlackService {
};

const activityLogId = await createActivityLog(log);
const logCtx = await getOperationContext(
{ id: String(activityLogId), type: 'action', message: 'Start action' },
{ account, environment: { id: environment_id } }
);

const actionResponse = await syncClient.triggerAction<SlackActionResponse>({
connection: slackConnection as NangoConnection,
actionName: this.actionName,
input: payload,
activityLogId: activityLogId as number,
environment_id,
logCtx
environment_id
});

await this.sendDuplicateNotificationToNangoAdmins(payload, activityLogId as number, environment_id, logCtx, undefined, admin_slack_timestamp);
await this.sendDuplicateNotificationToNangoAdmins(payload, activityLogId as number, environment_id, undefined, admin_slack_timestamp);

const content = isOk(actionResponse)
? `The action ${this.actionName} was successfully triggered for the ${syncType} ${syncName} for environment ${slackConnection?.environment_id} for account ${account.uuid}.`
Expand Down

0 comments on commit e3f45e1

Please sign in to comment.