-
Notifications
You must be signed in to change notification settings - Fork 13
feat: add email subscriptions #470
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
base: master
Are you sure you want to change the base?
Conversation
a108555 to
3d7c8df
Compare
f1150db to
2967361
Compare
2967361 to
6993a1a
Compare
|
Tests are failing for issue unrelated to this PR, should he fixed via #469 |
| subscriptions JSON DEFAULT NULL, | ||
| created BIGINT NOT NULL, | ||
| verified BIGINT NOT NULL DEFAULT 0, | ||
| PRIMARY KEY (email, address), |
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.
The primary key can be just address no? because a user cannot use multiple emails. this will help us to use queries like INSERT ... ON DUPLICATE KEY UPDATE to insert or update email subscription in src/writer/email-subscription.ts
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.
An address can be associated to multiple email addresses, but only one can be verified.
I think this was done so an unverified address can subscribe again with another email address
Co-authored-by: Chaitanya <[email protected]>
…abs/snapshot-sequencer into feat-add-subscription
This PR adds support for some of email subscriptions management through sequencer.
What will be supported (but same features still supported directly from envelop):
What will not be supported (and will remain on envelop):
This PR will make use of new changes from snapshot-labs/snapshot.js#1081
This PR introduces 2 new writers:
email-subscription: will create a new subscription when passing an email, else will update existing subscriptionsdelete-email-subscription: will delete a verified subscriptionHow to test
ENVELOP_DATABASE_URLFeatures
Create a subscription
This call from the SDK will create a new email subscription, if user is not subscribed yet.
In case the couple
wallet.address/emailalready exist, it will return aemail already subscribederror.This call will create a new unverified email subscription. The user will then receive an email on the given email address asking the user to verify his email (verification will be done through envelop directly)
For test purpose, you have to connect to the database, and update the
verifiedcolumn to something greater than 0 to continue testing update and deletion.The
subscriptionsvalue is empty, and always ignored on creation, and will default to everything.Update a subscription
This call from the SDK will update an existing subscription.
The
emailproperty is skipped (and uncessary), as there can be only one verified email associated to the wallet.This call will fail with
email not verifiedif email is not verified, oremail not subscribedwhen not existing.Delete a subscription
This call from the SDK will delete the active email subscription associated to the address.
Once again, email is not passed for privacy reason (and also unecessary), and this will delete the verified email subscription if any.
Call will fail with
email not subscribedif there's not verified email subscription to delete.For the
email-subscriptiontype, ipfs pinning will be skipped on email creation, and an empty string will be returned instead, as to not expose the user's email. (ipfs still pinning for email subscription update)Todo
ENVELOP_DATABASE_URL(on mainnet only)