Spoke
Spoke copied to clipboard
Fix: auto-optout if Redis is not enabled
Fixes #2186
Description
The reported issue was that auto-optout is not working if redis is not enabled.
I found the root cause in lookupByCell in src/server/models/cacheable_queries/campaign-contact.js.
We were not joining to campaign_contact when redis is enabled. Because of that, in src/server/models/cacheable_queries/message.js, neither organization nor campaignId was defined, which in turn prevented any message handlers from being called.
I added tests to show:
lookupByCellalways does the join tocampaign_contactauto-optout's members get called when we save a message
I also tested manually in the UI to show that if somebody responds with opt-out words, they do in fact get opted out.
Checklist:
- [x] I have manually tested my changes on desktop and mobile
- [x] The test suite passes locally with my changes
- [ ] If my change is a UI change, I have attached a screenshot to the description section of this pull request
- [x] My change is 300 lines of code or less, or has a documented reason in the description why it’s longer
- [ ] I have made any necessary changes to the documentation
- [x] I have added tests that prove my fix is effective or that my feature works
- [ ] My PR is labeled [WIP] if it is in progress