Skip to content
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

Add management command to send api move announcement email #4229

Merged

Conversation

sarayourfriend
Copy link
Collaborator

@sarayourfriend sarayourfriend commented Apr 30, 2024

Fixes

Part of #3742 by @sarayourfriend (does not fix because the issue also requires sending the email, i.e., running the command in production).

Description

Review the management command. The message text has already undergone review. The placeholder for the make post URL will be replaced before merging, after the post is available next week.

Testing Instructions

Review the code and confirm tests are adequate and pass.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • [N/A] I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@github-actions github-actions bot added the 🧱 stack: api Related to the Django API label Apr 30, 2024
@openverse-bot openverse-bot added the 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work label Apr 30, 2024
@sarayourfriend sarayourfriend added 🟨 priority: medium Not blocking but should be addressed soon 🌟 goal: addition Addition of new feature 💻 aspect: code Concerns the software code in the repository and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Apr 30, 2024
@sarayourfriend sarayourfriend marked this pull request as ready for review May 1, 2024 22:56
@sarayourfriend sarayourfriend requested a review from a team as a code owner May 1, 2024 22:56
@sarayourfriend sarayourfriend added 🟧 priority: high Stalls work on the project or its dependents and removed 🟨 priority: medium Not blocking but should be addressed soon labels May 1, 2024
@sarayourfriend
Copy link
Collaborator Author

Upgrading this to high priority so that we can send it out early next week along with the make post on Monday. #2037 for context.

@WordPress/openverse-api pinging y'all for expedited review to match the priority.

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

I was under the impression that we've sent bulk emails before and there was an existing management command to send out emails. I think I was wrong about that.

I think it's worth generalising this command to send any email, and keep the message as a separate file that can be passed to the command via CLI args. This way we can send emails in the future, with the same command and different content.

However, I'm okay with taking up this idea^ as a future improvement. This PR LGTM and I'm unblocking these except for some ideas to improve the message text.

api/api/management/commands/sendapimoveannouncement.py Outdated Show resolved Hide resolved

For the best experience, please update code referencing api.openverse.engineering to use api.openverse.org.

To read more about this change, including opportunities to ask questions or give feedback, please read the Make Openverse blog post announcing it:
Copy link
Member

Choose a reason for hiding this comment

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

This line should be wrapped like the others.

api/api/management/commands/sendapimoveannouncement.py Outdated Show resolved Hide resolved
api/api/management/commands/sendapimoveannouncement.py Outdated Show resolved Hide resolved
Copy link
Contributor

@stacimc stacimc left a comment

Choose a reason for hiding this comment

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

LGTM, tests are great. +1 to @dhruvkb's suggestions for the message text but approving to unblock.

I like the suggestion to make the command more general but strongly agree that should be a future iteration 👍

@sarayourfriend
Copy link
Collaborator Author

sarayourfriend commented May 3, 2024

The issue references the old management command that we sent an email with before: #3742

A general one is out of scope, as you've both said, but I want to share further context, as I don't believe we even need one. We've sent two emails in as many years, and the first was extremely specialised in the selection of who received it. It's hard to imagine it would be worth the time to write, test, and maintain a generalised management command when this one can be copy/pasted (and crucially in the meantime deleted, and not kept as unused code for who knows how long) and whatever modifications made as needed. Without knowing who the audience of a particular email is, you'd also need to work out how to specify that, and I'd really rather not have to dredge up memories of dealing with CSVs of SQL-exported email addresses in Django admin.

@dhruvkb
Copy link
Member

dhruvkb commented May 3, 2024

Agree on both points: generalising is out of scope for this PR and this code can be deleted when unused (at 2 emails in ~3 years this is basically 100% of the time).

@sarayourfriend sarayourfriend changed the title Add management command to send api move announcement email [DO NOT MERGE; PENDING MAKE POST LINK] Add management command to send api move announcement email May 3, 2024
@sarayourfriend
Copy link
Collaborator Author

sarayourfriend commented May 6, 2024

Because application emails are not unique, there is a chance of accidentally emailing people twice, if their multiple applications registered to a single email are pulled; that is, there is a chance of this if the distinct() call on the queryset is not filtering in each query set slicing inside the loop. I need to check this. I'll do so by adding a new unit test first to determine whether this is the case, and if so, fix the distinct call or modify the loop to prevent it. I'll do that before merging this, of course, as well as addressing the editorial remarks from @dhruvkb.

@dhruvkb and @stacimc Just an FYI that I did ask for editorial reviews from everyone in the maintainer group before marking this PR ready for review; ideally these editorial remarks would have been shared there, as some of them overlap with content in the Make post. Just giving context for where the text came from, and the process it's already been through. I appreciate the editorial feedback, but it would have been good to have it when the text was originally discussed, so that it could align with the Make post.

@sarayourfriend sarayourfriend force-pushed the add/api.openverse.org-announcement-mgmt-command branch from 85d4f95 to 147b056 Compare May 6, 2024 00:56
@sarayourfriend sarayourfriend changed the title [DO NOT MERGE; PENDING MAKE POST LINK] Add management command to send api move announcement email Add management command to send api move announcement email May 6, 2024
@sarayourfriend sarayourfriend merged commit 988e227 into main May 6, 2024
43 checks passed
@sarayourfriend sarayourfriend deleted the add/api.openverse.org-announcement-mgmt-command branch May 6, 2024 01:09
@sarayourfriend
Copy link
Collaborator Author

The emails are sent as of 2024-05-08T00:59:58.366Z.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🌟 goal: addition Addition of new feature 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: api Related to the Django API
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants