Spoke icon indicating copy to clipboard operation
Spoke copied to clipboard

Fix: auto-optout if Redis is not enabled

Open lperson opened this issue 3 years ago • 0 comments

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:

  • lookupByCell always does the join to campaign_contact
  • auto-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

lperson avatar Jul 09 '22 23:07 lperson