Skip to content

Commit

Permalink
chore: do not hold the conversation if there is no app
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustrb committed Oct 22, 2024
1 parent 22eb638 commit 509be44
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions apps/meteor/ee/server/patches/shouldTriggerVerificationApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ const runShouldTriggerVerificationApp = async (
contactId: ILivechatContact['_id'],
source: IOmnichannelSource,
): Promise<boolean> => {
const verificationRequirement = settings.get<AvailableLivechatRequireContactVerificationSetting>('Livechat_Require_Contact_Verification');
if (verificationRequirement === 'never') {
return false;
}

const contact = await LivechatContacts.findOneById<Pick<ILivechatContact, '_id' | 'unknown' | 'channels'>>(contactId, {
projection: {
_id: 1,
Expand All @@ -40,6 +35,13 @@ const runShouldTriggerVerificationApp = async (
return true;
}

// There is no configured verification app, so there is no reason to trigger a verification app, since
// none will be able to be assigned
if (settings.get<string>('Livechat_Contact_Verification_App') === '') {
return false;
}

const verificationRequirement = settings.get<AvailableLivechatRequireContactVerificationSetting>('Livechat_Require_Contact_Verification');
const isContactVerified = (contact.channels?.filter((channel) => channel.verified && channel.name === source.type) || []).length > 0;

// If the contact has never been verified and it needs to be verified at least once, trigger the app
Expand Down

0 comments on commit 509be44

Please sign in to comment.