Skip to content

backend: Add user email preference storing #1901

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

Merged
merged 5 commits into from
Nov 22, 2019

Conversation

DSpeckhals
Copy link
Contributor

This PR addresses the first step in implementing #1895: "Backend: email preference storing."

This commit is the first step in the process to send crate owners an email notification when a new version of one of their crates is published. A database migration adds a email_notifications column to the crate_owners table, and thus the property was added to the corresponding CrateOwner struct. This new property is defaulted to true.

Because a user may not want to receive a version publish notification for all of their crates, an API endpoint was added to allow them to toggle email notifications for each crate. The front end implementation will be in a forthcoming commit, as well as the actual sending of these notifications.

This commit is the first step in the process to send crate owners an
email notification when a new version of one of their crates is
published. A database migration adds a `email_notifications` column to
the `crate_owners` table, and thus the property was added to the
corresponding `CrateOwner` struct. This new property is defaulted to
`true`.

Because a user may not want to receive a version publish notification
for all of their crates, an API endpoint was added to allow them to
toggle email notifications for each crate. The front end implementation
will be in a forthcoming commit, as well as the actual sending of these
notifications.
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @carols10cents (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Copy link
Member

@carols10cents carols10cents left a comment

Choose a reason for hiding this comment

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

Progress on this is looking great! Just one spot where we need an added filter and another spot where we can change multiple UPDATEs to one INSERT. Please let me know if you have questions!!

Don't execute updates in a loop. This could lead to performance issues
when a large quantities of crates are being updated.

Also only operate on crate owners of type 'User'.
Also make the response for an invalid JSON request body a 400 instead of
a 200 HTTP status code.
Also don't use filter_map in inserts for the sake of simplicity.
@carols10cents
Copy link
Member

Looks great!!! Thank you so much!!

@bors r+

@bors
Copy link
Contributor

bors commented Nov 22, 2019

📌 Commit 2468eab has been approved by carols10cents

@bors
Copy link
Contributor

bors commented Nov 22, 2019

⌛ Testing commit 2468eab with merge 3dc6074...

bors added a commit that referenced this pull request Nov 22, 2019
…cents

backend: Add user email preference storing

This PR addresses the first step in implementing #1895: "Backend: email preference storing."

This commit is the first step in the process to send crate owners an email notification when a new version of one of their crates is published. A database migration adds a `email_notifications` column to the `crate_owners` table, and thus the property was added to the corresponding `CrateOwner` struct. This new property is defaulted to `true`.

Because a user may not want to receive a version publish notification for all of their crates, an API endpoint was added to allow them to toggle email notifications for each crate. The front end implementation will be in a forthcoming commit, as well as the actual sending of these notifications.
@bors
Copy link
Contributor

bors commented Nov 22, 2019

☀️ Test successful - checks-travis
Approved by: carols10cents
Pushing 3dc6074 to master...

@bors bors merged commit 2468eab into rust-lang:master Nov 22, 2019
@DSpeckhals DSpeckhals deleted the email-preference-storing branch November 22, 2019 14:30
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.

5 participants