Skip to content

Commit

Permalink
chore: code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 committed Nov 10, 2023
1 parent 1f4a217 commit 264f326
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cdk/v2/destinations/gladly/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ steps:
- name: preparePayload
template: |
$.context.payload = {
name: .message.context.traits.name || .message.traits.name,
image: .message.context.traits.avatar || .message.traits.avatar,
address: .message.context.traits.address || .message.traits.address
name: .message.traits.name || .message.context.traits.name,
image: .message.traits.avatar || .message.context.traits.avatar,
address: .message.traits.address || .message.context.traits.address
}
$.context.payload.address && typeof $.context.payload.address === "object" ? $.context.payload.address = JSON.stringify($.context.payload.address)
$.context.payload.emails = $.formatField(.message, "email")
Expand Down
4 changes: 4 additions & 0 deletions src/cdk/v2/destinations/gladly/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const formatField = (message, fieldName) => {
};

const getCustomAttributes = (message) => {
if (message.traits?.customAttributes && typeof message.traits?.customAttributes === 'object'){
return message.traits?.customAttributes;
}

const customAttributes = message.context.traits;
reservedCustomAttributes.forEach((customAttribute) => {
if (customAttributes[customAttribute]) {
Expand Down

0 comments on commit 264f326

Please sign in to comment.