-
Notifications
You must be signed in to change notification settings - Fork 7
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
Async team deletion with email #1169
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files📢 Thoughts on this report? Let us know! |
… audit context errors
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.
Few small comments but looks good
@@ -548,6 +548,7 @@ | |||
"account_reset_password_from_key", | |||
"teams:signup_after_invite", | |||
"account_login", | |||
"single_team:delete_team", |
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.
Why was this necessary?
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.
See #1169 (comment)
apps/utils/deletion.py
Outdated
@@ -218,3 +222,27 @@ def get_related_pipelines_queryset(instance, pipeline_param_key: str = None): | |||
Q(**{f"params__{pipeline_param_key}": instance.id}) | Q(**{f"params__{pipeline_param_key}": str(instance.id)}) | |||
) | |||
return pipelines | |||
|
|||
|
|||
def get_admin_emails(team): |
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.
this is a good candidate for a test
|
||
# get required info for emails prior to deleting team info | ||
team_name = team.name | ||
admin_emails = get_admin_emails_with_delete_permission(team) |
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.
Should all users maybe be notified instead of only those that can delete the team? It might be a bit surprising for someone to find their team is gone. Probably an edge case, but still
I realize you are still busy with this PR, but just flagging that we are not removing assistants from OpenAI yet? A test for |
|
||
@pytest.mark.django_db() | ||
def test_get_admin_emails_can_delete_team(team_with_users): | ||
set_current_team(team_with_users) |
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.
you could use the current_team
context manager to ensure that it is unset
|
||
@shared_task | ||
def delete_team_async(team_id): | ||
team = Team.objects.get(id=team_id) |
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.
use with current_team(team)
to set the team for auditing
Description
first part of this ticket: #1097
Please especially provide feedback on email wording and other things that are helpful to add for context in the email
User Impact
All teams admins will receive emails and it will be more clear to the deletee when the team is actually finished deleted rather than seemingly instant
Demo
Docs and Changelog
will add 👍