Skip to content

Commit

Permalink
adjust when contact and handler context are checked
Browse files Browse the repository at this point in the history
  • Loading branch information
engelhartrueben committed Dec 9, 2024
1 parent e73268c commit c76587f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/extensions/message-handlers/ngpvan-optout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const available = organization =>
/* Sends a request to VAN to place an opt out tag to an individual.
*/
export const postMessageSave = async ({
_, // message
contact,
handlerContext,
organization
Expand All @@ -38,6 +37,11 @@ export const postMessageSave = async ({
let customField;
let vanId;

if (
!contact ||
!handlerContext.autoOptOutReason
) return {};

// Checking for vanID in contact
// While Van.postCanvassResponse will check the customFields,
// we don't want to call that function every time if a vanid
Expand All @@ -51,11 +55,6 @@ export const postMessageSave = async ({
return {};
}

if (
!contact ||
!handlerContext.autoOptOutReason
) return {};

// Testing shows that "-" , "(", and ")" break this request
const cell = contact.cell.replace(/\D/g,'')

Expand Down

0 comments on commit c76587f

Please sign in to comment.