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

Allow users to remove themselves from a project #8384

Merged
merged 4 commits into from
Aug 18, 2021

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Aug 2, 2021

This is only possible if they aren't the only one left.

Closes #7527

This is only possible if they aren't the only one left
@stsewd stsewd requested a review from a team August 2, 2021 18:43
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

Looks good other than the UX and template logic.

@@ -553,12 +557,15 @@ def post(self, request, *args, **kwargs):
self.get_queryset(),
username=username,
)
if user == request.user:
if self._is_last_user():
raise Http404
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a bad UX. We probably want some kind of messaging, not a blank 404.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, but this is outisede a form, not sure if we can display an error to the view level instead of the form level. Also this case also only happens if the user triggers the request manually or if another user has removed itself in another request, the UI doesn't show you the option if you are the only one.

Let me know if we should still display an error, maybe in the 404?

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this be a 400 saying that you can't remove yourself if you are the last/only user of the project?

Copy link
Member

Choose a reason for hiding this comment

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

Could this be validated in the form?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have a form here, this is just a normal view (we don't display the option to remove yourself if you are the only one left). I have changed the status code to 400.

readthedocs/templates/projects/project_users.html Outdated Show resolved Hide resolved
@stsewd stsewd merged commit 2c87233 into master Aug 18, 2021
@stsewd stsewd deleted the alllow-users-to-remove-themselves branch August 18, 2021 16:53
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.

Allow users to remove themselves from a project
3 participants