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

984 admin user actions dropdown #1001

Merged
merged 18 commits into from
Dec 6, 2024
Merged

Conversation

Chelakhovl
Copy link
Collaborator

Frontend:
Dropdown Menu in the Дії (Actions) Column:

A dropdown menu was added for each user in the Actions column, containing:

  • Send Message (Надіслати лист): Opens a modal for sending a custom email to the user.
  • View Profile (Переглянути профіль): Redirects to the detailed profile page of the selected user.
  • Block User (Заблокувати користувача): Opens a confirmation modal to block the user.

Send Message:
A form appears for composing a message, which sends the email to the user's registered address.
If successful, a confirmation message is displayed.
On error, an appropriate error message is shown.

View Profile:
Redirects to the user's detailed profile page (/customadmin/users/<user_id>).
Shows an error message if the profile cannot be loaded.

Block User:
Prompts the admin with a confirmation modal before proceeding.
On confirmation, sends a request to block the user.
If successful, updates the user’s status in the UI.
Displays appropriate error messages for inactive users or failed actions.

Error Handling:
Proper error messages are displayed for each action based on the server response.
Buttons are disabled during processing to prevent multiple clicks.

Backend:
Endpoints Implemented:

  • Send Message (/api/admin/users/<user_id>/send_message/):
    Validates message data and sends an email to the user.
    Returns appropriate success or error responses.
  • Block User (/api/admin/users/<user_id>/block/):
    Blocks the user by marking them as inactive.
    Handles scenarios where the user is already inactive or does not exist.

Tests:
SendMessageView Tests:
Successful message sending.
Error scenarios: short message, unauthorized access, user not found.
BlockUserView Tests:
Successful blocking.
Error scenarios: user already inactive, user not found, unauthorized access.

TASK: #984

1
2
3
4
5
6
7
8
9
10
11
12

@Chelakhovl Chelakhovl self-assigned this Dec 3, 2024
@Chelakhovl Chelakhovl merged commit 904d905 into develop Dec 6, 2024
4 checks passed
@Chelakhovl Chelakhovl deleted the 984-admin-user-actions-dropdown branch December 10, 2024 14:18
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.

3 participants