Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: remove user from project 🙅 #1349

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

luke-mcfarlane-rocketlab
Copy link
Contributor

JIRA Ticket

BSS-666

Description

Added the ability to remove users from a project.

Proposed Changes

  • added API endpoint to remove user from project
  • small fix on couchdb function so that projectrole is delete when user has no roles
  • added remove project dialog
  • few small updates to project users table

How to Test

  1. Open a project
  2. Navigate to the "Invites" section
  3. Copy the non-admin invite link
  4. Open in a private browsing window and create a user
  5. In your main window navigate to the "Users" section
  6. Delete the new user from the project
  7. (optional) Verify the user is still in the main users table

Additional Information

I have made it so that you cannot remove admins from surveys for now.

Checklist

  • I have confirmed all commits have been signed.
  • I have added JSDoc style comments to any new functions or classes.
  • Relevant documentation such as READMEs, guides, and class comments are updated.

Signed-off-by: Luke McFarlane <luke.mcfarlane@rocketlab.com.au>
Signed-off-by: Luke McFarlane <luke.mcfarlane@rocketlab.com.au>
Signed-off-by: Luke McFarlane <luke.mcfarlane@rocketlab.com.au>
Signed-off-by: Luke McFarlane <luke.mcfarlane@rocketlab.com.au>
Copy link
Contributor

@ranisa-gupta16 ranisa-gupta16 left a comment

Choose a reason for hiding this comment

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

Just very few minor ones for error handling. Thanks!


const user = await getUserFromEmailOrUsername(req.params.user_id);

if (!user) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if user is not found, can we return a 404 response instead of internal server error?

<Button
variant="destructive"
className="w-full"
onClick={async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

add a try-catch block please to handle any errors.

}
);

if (!response.ok) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

also we can throw an error like Failed to remove user by displaying the appropriate message for the user.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants