-
Notifications
You must be signed in to change notification settings - Fork 4
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
Update subscriber list titles on major / minor publication events #493
Conversation
b0351a4
to
56d94af
Compare
6db6f30
to
5d7388a
Compare
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.
As a general comment, it feels a bit heavyweight adding a second major change processor for this. Not only do we have two message queues with exactly the same events in them, it could be kind of confusing to someone encountering this for the first time.
So rather than adding a second major change queue, my inclination would be to do both the content change triggering and the UpdateSubscriberList.new(document, logger).trigger
inside the existing major change queue - and then call the new minor change queue minor-change-queue-consumer
to fit the naming pattern of the others.
[Trello](https://trello.com/c/IkYegsOt/1225-update-subscriberlist-titles-on-major-minor-publishing-change) Dependent on ============ alphagov/email-alert-service#493 See also ======== 5c4c0e2
5d7388a
to
0d16dab
Compare
Yeah I see what you mean, and that would be slimmer, my fear is that if we entangle the two is there any risk of errors in our updates preventing content-changes from occuring? I can't really think of a sensible secenario, given they are both hitting the same email-alert-api. Do you think it remains confusing even though we've given them a very explicit name here? |
Mmm, that's a good point. In that case, I think we should have one new worker which receives all major and minor publishing events - rather than two new workers which do the same thing but with slightly different inputs. |
0d16dab
to
2e166af
Compare
Co-authored-by: Alex Whitehead-Smith <alex.whitehead-smith@digital.cabinet-office.gov.uk> Co-authored-by: Huw Diprose <huw.diprose@digital.cabinet-office.gov.uk>
2e166af
to
3b57d92
Compare
@alex9smith and I tried that initially. So we couldn't have two running side by side from the same rake task? Then we went down a RabbitMQ hole of "can you use regex to do multiple key matches". I found some blog posts with someone talking about "a cool hack" they'd written that seemed to suggest it's not built in. Without a super easy, standard way to match multiple routing keys (major || minor), making two with their own processors seemed like the best route? |
I think matching |
Yeah that does work, but my concern there is that all our logger events just start clogging up logs. I don't know how many events there might be... but seems like a lot. Having the two new processors seems to give us the targeting we want, with some admitted cruft. I'd hope at least that gives a solid base for a future refactor if more of these get added in future and the number of processors becomes unwealdy? |
Ok, I'm not going to die on this hill - let's go with the approach of having two new queues. |
e3b03ed
to
d7b4581
Compare
Extend the processors added in #493 to also check if the subscriber list description has changed with a major or minor content change. If it has, send the new version to email alert API. These descriptions will be included in the emails sent when a page is unpublished, so it's important that they're kept up to date. Depends on alphagov/email-alert-api#1709
d7b4581
to
150304c
Compare
WHAT ==== The GOV.UK Accounts team added a feature where logged in users could subscribe to email notifications for individual pages. SubscriberLists store the titles of those pages so that we can: - Render a list of subscriptions in the user's manage dashboard - Include the title of the subscriber list in emails alerting the user that the page has been unpublished. (Especially as there's no-longer a content item we can query for title at that point). We record these titles when the SubscriberList is first made, however there has not been a mechanism to update it. This is a problem as content titles do change over time. This PR adds a class we can use to gather information from major and minor change messages and update the subscriber list titles using a new [Email Alert API endpoint](1) Other parts of email-alert-service make calls to services that use GDS API adaptors. However they seem not to use the test helpers that ship with the gem through webmock. (1): alphagov/email-alert-api#1704 Co-authored-by: Alex Whitehead-Smith <alex.whitehead-smith@digital.cabinet-office.gov.uk> Co-authored-by: Huw Diprose <huw.diprose@digital.cabinet-office.gov.uk>
These used to be specific validations to unpublication and content change processors. As we're about to re-use these in a new processor (see next commit) lets move them up to the parent class. Co-authored-by: Alex Whitehead-Smith <alex.whitehead-smith@digital.cabinet-office.gov.uk> Co-authored-by: Huw Diprose <huw.diprose@digital.cabinet-office.gov.uk>
Co-authored-by: Alex Whitehead-Smith <alex.whitehead-smith@digital.cabinet-office.gov.uk> Co-authored-by: Huw Diprose <huw.diprose@digital.cabinet-office.gov.uk>
150304c
to
4d53664
Compare
Co-authored-by: Alex Whitehead-Smith <alex.whitehead-smith@digital.cabinet-office.gov.uk> Co-authored-by: Huw Diprose <huw.diprose@digital.cabinet-office.gov.uk>
:wq It's now shared between two classes, a module makes more sense. I've given it its own test file too
We ended up with nearly three identical blocks of code, this looks like a good time to DRY it out. Especially if we may add other similar ones in future.
4d53664
to
8865666
Compare
Extend the processors added in #493 to also check if the subscriber list description has changed with a major or minor content change. If it has, send the new version to email alert API. These descriptions will be included in the emails sent when a page is unpublished, so it's important that they're kept up to date. Depends on alphagov/email-alert-api#1709
[Trello](https://trello.com/c/IkYegsOt/1225-update-subscriberlist-titles-on-major-minor-publishing-change) Dependent on ============ alphagov/email-alert-service#493 See also ======== 5c4c0e2
[Trello](https://trello.com/c/IkYegsOt/1225-update-subscriberlist-titles-on-major-minor-publishing-change) Dependent on ============ alphagov/email-alert-service#493 See also ======== 5c4c0e2
We added new queues to the email-alert-service to update subscriber list details when the page they alert for is updated. [[1]] There are alerts that might go off for these queues that will link to this document, so we need to add links to the queue config here. [1]: alphagov/email-alert-service#493
We added new queues to the email-alert-service to update subscriber list details when the page they alert for is updated. [[1]] There are alerts that might go off for these queues that will link to this document, so we need to add links to the queue config here. [1]: alphagov/email-alert-service#493
We added new queues to the email-alert-service to update subscriber list details when the page they alert for is updated. [[1]] There are alerts that might go off for these queues that will link to this document, so we need to add links to the queue config here. [1]: alphagov/email-alert-service#493
Trello
Depends on
alphagov/email-alert-api#1704
(and it's release)
What
The GOV.UK Accounts team added a feature where logged in users could
subscribe to email notifications for individual pages.
SubscriberLists store the titles of those pages so that we can:
that the page has been unpublished. (Especially as there's no-longer a
content item we can query for title at that point).
We record these titles when the SubscriberList is first made, however
there has not been a mechanism to update it. This is a problem as
content titles do change over time.
This PR adds a class we can use to gather information from major and
minor change messages and update the subscriber list titles using a new
Email Alert API endpoint
Other parts of email-alert-service make calls to services that use GDS
API adaptors. However they seem not to use the test helpers that ship
with the gem through webmock.
A note on test strategy
In previous work we decided to keep the testing strategy consistent
across the repo, and also avoided gds-api-test helpers. Instead we
tested with double and spys.
This got us into a bit of trouble when our parameters and payloads were
not matching the gds-api-adaptors, and reminded us how helpful those
test helpers were.
So we've introduced stubs and webmock for this test, aware this
introduces an inconsistent test strategy.
We intend to go back and refactor tests for the recently introduced
unpublication alert work. And hopefully refactor the rest of the test
suite to.
If you are far in the future and that didn't happen. Sorry! But
hopefully you at least know why these tests don't look like the others.
(1): alphagov/email-alert-api#1704