-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Link messages to campaign contacts #61
[WIP] Link messages to campaign contacts #61
Conversation
src/server/api/lib/twilio.js
Outdated
@@ -44,6 +44,7 @@ async function convertMessagePartsToMessage(messageParts) { | |||
contactNumber | |||
}) | |||
return new Message({ | |||
campaign_contact_id: lastMessage.campaign_contact_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be
lastMessage && lastMessage.campaign_contact_id
We should still save it in the db I think!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below references it directly with assignment_id: lastMessage.assignment_id
, should we change there as well or assume that's working with the unsafe reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooof, good point. I would say yes – that would cause an uncaught exception, and our application should have no uncaught exceptions, yeah?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we should enforce that lastMessage
exists and ignore incoming messages that aren't associated with a campaign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no harm to saving them, and then maybe in like a week looking at what they are?
…messages Link messages to campaign contacts
We either need to allow null values for campaign_contact_id or we need to do a three-part migration: adding a nullable column, associating all messages with their campaigns, and making the column non-nullable.