ucsb-cs156-s24 / proj-happycows-s24-4pm-5

https://ucsb-cs156-s24.github.io/proj-happycows-s24-4pm-5/
1 stars 0 forks source link

Added Suspended Field, Suspend Button, and Restore Button to UsersTable #65

Closed GarvinYoung closed 4 months ago

GarvinYoung commented 4 months ago

Overview

In this pr we allow people with access to the usersTable to see if a certain user is suspended or not. If the person with access to a table is an admin, they also have access to a "Suspend" and a "Restore" button that changes that row's user's suspend value

Screenshots

This is the usersTable while I'm logged into an admin account image

Dependencies

PR #63 and PR #59 must be merged before this PR since this PR uses the suspend endpoints and suspend fields in the user object from those PRs respectively.

Future Possibilities

This is the first frontend part of the suspend EPIC, the issue following this will add a modal for confirming a suspension or restoration of a user

Validation

  1. Visit my dokku deployment here: https://happycows-garvinyoung-dev2.dokku-05.cs.ucsb.edu/
  2. Login using an admin account
  3. Navigate to usersTable (go to Admin dropdown on navbar then click on "Users"
  4. Check if you can see the "Suspend" and "Restore" buttons and play around with them, to see the "Suspended" field with an updated value, you will need to refresh the page to rerender the table. Additionally, if you use this on another app with existing members, the "Suspended" field will return null since those users were created before the suspended field was added. Simply click on one of the buttons to update their "Suspended" field.

Tests

Made tests for usersUtils.js and expanded existing tests and well as making new ones in UsersTable.test.js to cover the correct rendering of the new columns in the table as well as ensuring the buttons function correctly on click.

Linked Issues

Closes #42

pconrad commented 4 months ago

This PR has a bug in it, in the sense that it does not properly handle the React Query key so that the page refreshes. I'll merge it anyway, but you should mention this in the release notes.