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

feat: support auto reply handling #1663

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft

Conversation

ajohn25
Copy link
Contributor

@ajohn25 ajohn25 commented Aug 12, 2023

Description

This PR adds all backend changes required to support auto reply handling.

This does not expose any auto reply functionality to users intentionally, to allow for an easier slow rollout of this feature if desired.

Motivation and Context

Part 1 of 2 for #1526

How Has This Been Tested?

See message-sending.spec.ts

Screenshots (if appropriate):

Documentation Changes

Checklist:

  • My change requires a change to the documentation.
  • I have included updates for the documentation accordingly.

@ajohn25 ajohn25 requested review from hiemanshu and bchrobot August 12, 2023 01:05
);

drop index todos_partial_idx;
create index todos_partial_idx on campaign_contact (campaign_id, assignment_id, message_status, is_opted_out, auto_reply_eligible) where (archived = false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting that this adds auto_reply_eligible to todos_partial_idx. I think this is a good move because the field is functionally pretty similar to is_opted_out but welcome any thoughts otherwise!

@ajohn25 ajohn25 marked this pull request as draft August 12, 2023 01:18
@ajohn25 ajohn25 force-pushed the feat-auto-reply-handling branch from 9870a31 to 7cd7433 Compare August 12, 2023 02:13
@ajohn25 ajohn25 marked this pull request as ready for review August 12, 2023 02:16
@ajohn25 ajohn25 marked this pull request as draft August 14, 2023 00:04
@ajohn25
Copy link
Contributor Author

ajohn25 commented Aug 14, 2023

@bchrobot @hiemanshu the failing test here requires ENABLE_AUTO_REPLIES = true to pass. I do want to keep the default for that value as false so that we're disabling this feature by default. Do either of you have thoughts about if there's a way to get around that within the test file 🤔 ?

@bchrobot
Copy link
Member

@bchrobot @hiemanshu the failing test here requires ENABLE_AUTO_REPLIES = true to pass. I do want to keep the default for that value as false so that we're disabling this feature by default. Do either of you have thoughts about if there's a way to get around that within the test file 🤔 ?

The easy route is to do something similar to what we do in Switchboard: separating the config object itself from the parsed environment variables:

https://github.com/politics-rewired/switchboard/blob/6686f0bc304065e20dbe8a509130e3b746856328/src/config.ts#L96-L100

Another option is to use Jest mocks. I have struggled to make this to work for specific object properties before, but this approach might work:

https://stackoverflow.com/a/67897729
or https://stackoverflow.com/a/65082112

@hiemanshu
Copy link
Contributor

To add to what Chrobot said above, we should have a different config for tests, that enables all the flags possible. We should test with all possible features turned on.

@bchrobot
Copy link
Member

@ajohn25 would you update the SQL schema dump? Having a hard time reviewing the auto-assignment views migration on its own

@ajohn25
Copy link
Contributor Author

ajohn25 commented Aug 17, 2023

@bchrobot sorry i converted this back to draft to address a few things i thought of - one of those being that update-dump wasn't working for me 😭

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.

3 participants