feat: return email subscription data in User #951
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Toward https://github.com/snapshot-labs/workflow/issues/226
This PR returns email subscriptions data from envelop, directly from the hub, in the user(s) object.
Instead of sending an extra query to fetch user email subscription info, we can know get if from the hub with
Which will return something like
In case user is not subscribed, it will return
Returning email subscription data from the hub will avoid having to manage another read API on sx side.
A sister PR (snapshot-labs/snapshot.js#1081) will merge the write function inside sequencer.
NOTE
The envelop DB connection is optional, and will always return data as
NOT_SUBSCRIBED
if not present (useful for the testnet)TODO
ENVELOP_DATABASE_URL=
to envelop mysql database url