Skip to content

Commit 9c7a914

Browse files
committed
fix: pr review requests
1 parent cf5cf12 commit 9c7a914

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/server/api/lib/message-sending.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,21 @@ export const getContactMessagingService = async (
123123
select 1
124124
from campaign_contact
125125
where messaging_service_stick.cell = campaign_contact.cell
126-
and campaign_contact.id = 181403618
126+
and campaign_contact.id = ?
127127
)
128128
and organization_id = ?
129129
);
130130
`,
131131
[campaignContactId, parseInt(organizationId)]
132132
);
133133

134-
if (!existingMessagingService)
135-
throw new Error(`Unknown campaign contact ID ${campaignContactId}`);
136-
137-
// Return an existing match if there is one - this is the vast majorityu of cases
138-
const isRealService = existingMessagingService.messaging_service_sid !== null;
139-
if (isRealService) return existingMessagingService;
134+
// Return an existing match if there is one - this is the vast majority of cases
135+
if (
136+
existingMessagingService &&
137+
existingMessagingService.message_service_sid !== null
138+
) {
139+
return existingMessagingService;
140+
}
140141

141142
const campaignContact = await r
142143
.reader("campaign_contact")
@@ -148,6 +149,7 @@ export const getContactMessagingService = async (
148149
campaignContact.cell,
149150
parseInt(organizationId)
150151
);
152+
151153
return assignedService;
152154
};
153155

0 commit comments

Comments
 (0)