-
Notifications
You must be signed in to change notification settings - Fork 645
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
Conversation
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.
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. |
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.
Progress on this is looking great! Just one spot where we need an added filter
and another spot where we can change multiple UPDATE
s 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.
Looks great!!! Thank you so much!! @bors r+ |
📌 Commit 2468eab has been approved by |
…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.
☀️ Test successful - checks-travis |
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 thecrate_owners
table, and thus the property was added to the correspondingCrateOwner
struct. This new property is defaulted totrue
.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.