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

feat: add user ban functionality with API integration and UI components #14725

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

Conversation

usamabinnadeem-10
Copy link
Contributor

@usamabinnadeem-10 usamabinnadeem-10 commented Feb 6, 2025

Done

This pull request introduces a new feature for managing user bans in the credentials dashboard. It includes the addition of new API functions, UI components, and data handling for user bans. The most important changes are summarised below:

New API Functions

  • Added getUserBans and ensureCUEUserBan functions to handle fetching and updating user bans. (static/js/src/advantage/credentials/dashboard/api/queryFns.ts)

UI Components

  • Introduced UserBanForm and UserBans components to create and display user bans, respectively. (static/js/src/advantage/credentials/dashboard/components/UserBanForm/UserBanForm.tsx) [1] (static/js/src/advantage/credentials/dashboard/components/UserBans/UserBans.tsx) [2]
  • Added routes for the new user ban components in the Routes component. (static/js/src/advantage/credentials/dashboard/components/Routes/Routes.tsx)
  • Updated the Sidebar component to include a link to the user bans page. (static/js/src/advantage/credentials/dashboard/components/Sidebar/Sidebar.tsx)

Utility Functions

  • Added utility functions for date formatting and conversion in common.ts. (static/js/src/advantage/credentials/dashboard/utils/common.ts)

Backend Integration

  • Added new routes and methods in the backend to support user ban operations. (webapp/app.py) [1] (webapp/shop/api/ua_contracts/api.py) [2] (webapp/shop/cred/views.py) [3]

QA

  • Check out this feature branch
  • Run the site using the command ./run serve or dotrun
  • View the site locally in your web browser at: http://0.0.0.0:8001/
    • Be sure to test on mobile, tablet and desktop screen sizes
  • Go to /credentials/dashboard/users/ensure-ban and create a user ban
    • It should show up in the table located at /credentials/dashboard/users/user-bans
  • Try unbanning and modifying a banned user, it should reflect in the table accordingly

Issue / Card

Fixes
WD-18762
WD-18763
WD-18764

Help

QA steps - Commit guidelines

@webteam-app
Copy link

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.26%. Comparing base (2bd5af1) to head (c08dc24).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14725      +/-   ##
==========================================
- Coverage   72.32%   72.26%   -0.06%     
==========================================
  Files         120      120              
  Lines        3404     3404              
  Branches     1174     1174              
==========================================
- Hits         2462     2460       -2     
- Misses        917      919       +2     
  Partials       25       25              

see 1 file with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants