-
Notifications
You must be signed in to change notification settings - Fork 199
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
MNTOR-2945: add del subscription api and unsub before deleting an user #4303
Conversation
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.
Unfortunately it appears like I'm getting an error when trying it locally - shouldn't the request to FxA be authenticated somehow?
And I think we also don't want to try unsubscribing if we just got a notification from FxA that the user has been unsubscribed?
(And a small question: won't this a bit too noisy for our logs?)
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.
Thanks, the code makes sense to me now. But when I try it out locally, I'm getting
deleteSubscriber error: delete from "subscribers" where "fxa_uid" = $1 returning "id" - update or delete on table "subscribers" violates foreign key constraint "onerep_scans_onerep_profile_id_foreign" on table "onerep_scans"
I wonder if we're missing a cascade somewhere to also delete scans and scan results when we delete a subscriber?
Hmm interesting.. Is the db migration up to date? |
Co-authored-by: Vincent <Vinnl@users.noreply.github.com>
*/ | ||
// Not covered by tests; mostly side-effects. See test-coverage.md#mock-heavy | ||
/* c8 ignore start */ | ||
async function getSubscriptions(bearerToken) { |
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.
@Vinnl I also refactored the code a little bit so the GET call is now separate and reusable.. in case one day we do want to address the unsubscribe vs. resubscribe
CTA in settings
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.
I don't understand how we're sure the subscription ID is for the monitor
subscription. Have you tested this with an account that is subscribed to multiple services?
We should really convert this to typescript and use the newer formatting rules, is that already in our tech debt epic? That part isn't a blocker for this PR, but not being able to use structured logging here is annoying.
@rhelmer Thanks for catching that, verified the fix in heroku just now. The unsub works
|
References:
Jira: MNTOR-2945
Description
Implement the unsubscribe feature correctly as a part of deletion, so the user
Screenshot (if applicable)
Not applicable.
How to test
In heroku, use a new account to subscribe to Plus. Delete that account. Watch for
unsubscribe
email to come through from FxAChecklist (Definition of Done)