Add bulk add functionality for disposable email domains#23726
Merged
Add bulk add functionality for disposable email domains#23726
Conversation
24ccff1 to
f476c04
Compare
- Implemented the `bulk_add_disposable_email_domains` task to handle the addition of these domains. - Added a management command to facilitate bulk addition from a CSV file. - Created unit tests to ensure the functionality works as expected, including handling of duplicate entries.
f476c04 to
54fdf4c
Compare
eviljeff
requested changes
Jul 25, 2025
src/olympia/users/management/commands/bulk_add_disposable_domains.py
Outdated
Show resolved
Hide resolved
eviljeff
approved these changes
Jul 28, 2025
Member
eviljeff
left a comment
There was a problem hiding this comment.
There should be an issue and a link to the issue in the description.
From testing (I didn't notice it before): we should probably .trim() at least the domain - we can't guarantee all the .csv files will be clean
In the interests of getting this priority command merged I'm approving, though the outstanding code quality comments remain unaddressed.
742bb9d to
80cb236
Compare
eviljeff
pushed a commit
that referenced
this pull request
Jul 28, 2025
* Add bulk add functionality for disposable email domains - Implemented the `bulk_add_disposable_email_domains` task to handle the addition of these domains. - Added a management command to facilitate bulk addition from a CSV file. - Created unit tests to ensure the functionality works as expected, including handling of duplicate entries. * Fix comments * TMP: Respond to comments. * Robustify the testimajigger. * A great offering to the oracle of beautiful python. * Strip whitespace from domain * Fix broken test
eviljeff
pushed a commit
that referenced
this pull request
Jul 28, 2025
* Add bulk add functionality for disposable email domains - Implemented the `bulk_add_disposable_email_domains` task to handle the addition of these domains. - Added a management command to facilitate bulk addition from a CSV file. - Created unit tests to ensure the functionality works as expected, including handling of duplicate entries. * Fix comments * TMP: Respond to comments. * Robustify the testimajigger. * A great offering to the oracle of beautiful python. * Strip whitespace from domain * Fix broken test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
bulk_add_disposable_email_domainstask to handle the addition of these domains.Description
Add a task + command to execute the task, taking a csv file (via the command) path, extracting the (domain, provider) values and passing them to the task.
The task bulk adds the records in batches to handle gracefully large payloads. Currently, it logs errors that fail django model validation, removes the m from the list of domains to add and continues.
Context
We want an easy way to process large numbers of domain block requests.
Testing
TBD: see the automated tests, we should be covering the following edge cases:
Task level:
DisposableEmailRestrictionTo run the task, from a django shell run something like
You can inspect result and check the
result.statusto see if it was ran successfully, you can verify the records exist in the database.Command level:
To execute the command run from a shell
Checklist
#ISSUENUMat the top of your PR to an existing open issue in the mozilla/addons repository.