Skip to content
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

Merged
merged 8 commits into from
Feb 26, 2019

Conversation

bchrobot
Copy link
Member

@bchrobot bchrobot commented Feb 25, 2019

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.

@bchrobot bchrobot changed the base branch from main to politics-rewired/deploy February 25, 2019 19:02
@@ -44,6 +44,7 @@ async function convertMessagePartsToMessage(messageParts) {
contactNumber
})
return new Message({
campaign_contact_id: lastMessage.campaign_contact_id,
Copy link
Contributor

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!

Copy link
Member Author

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?

Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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?

@ben-pr-p ben-pr-p merged commit d0e051c into politics-rewired/deploy Feb 26, 2019
@bchrobot bchrobot deleted the politics-rewired/linked-messages branch February 26, 2019 13:45
bchrobot pushed a commit that referenced this pull request Feb 27, 2019
…messages

Link messages to campaign contacts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants