[PR #3937] [MERGED] chore(sh-admin): alert the user while deleting users who are team owners #4601

Closed
opened 2026-03-17 02:07:29 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3937
Author: @jamesgeorge007
Created: 3/26/2024
Status: Merged
Merged: 3/28/2024
Merged by: @AndrewBastin

Base: release/2024.3.0Head: sh-admin-user-deletion-updates


📝 Commits (6)

  • 80b9941 chore: alert the user while deleting users who are team owners
  • 17db483 refactor: leverage helpers
  • 8a8cdcf chore: more specific error message while removing Admin status
  • dee7864 chore: address CR comments
  • 986a4b1 refactor: remove metadata + simplify types
  • d6babae chore: redirect to users page only in error case after user deletion

📊 Changes

6 files changed (+180 additions, -63 deletions)

View changed files

📝 packages/hoppscotch-sh-admin/locales/en.json (+3 -0)
📝 packages/hoppscotch-sh-admin/src/helpers/errors.ts (+5 -2)
packages/hoppscotch-sh-admin/src/helpers/userManagement.ts (+119 -0)
📝 packages/hoppscotch-sh-admin/src/modules/i18n.ts (+20 -1)
📝 packages/hoppscotch-sh-admin/src/pages/users/_id.vue (+3 -9)
📝 packages/hoppscotch-sh-admin/src/pages/users/index.vue (+30 -51)

📄 Description

Description

Attempting to delete users who are owners of at least one team from the Admin dashboard is an action that would fail. There wasn't any feedback previously while attempting to delete users from the list view/a user via the profile view. This PR adds an error toast that will be shown during the scenarios mentioned above.

Changes

  • Show an error toast while attempting to delete users who are team owners from the list /users and profile /user/_id views.
  • Locale entry additions for the case with attempting team owner deletions.
  • Ensure the singular/plural form of the error toast message is displayed based on the no. of rows selected from the user management list view (/users page).
  • Abstract the user deletion business logic in a helper function handleUserDeletion() under helpers/userManagement.ts.
  • New getI18n() function exported from the i18n module for use outside components.
  • At least one Admin is enforced on an instance. Show a more specific error message while attempting to remove the Admin status that would lead to a scenario with no users with Admin privileges.

Closes HFE-462.

Checks

  • My pull request adheres to the code style of this project
  • All the tests have passed

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/3937 **Author:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Created:** 3/26/2024 **Status:** ✅ Merged **Merged:** 3/28/2024 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `release/2024.3.0` ← **Head:** `sh-admin-user-deletion-updates` --- ### 📝 Commits (6) - [`80b9941`](https://github.com/hoppscotch/hoppscotch/commit/80b99413997089f867b3c05b0db7c15ab199e7e2) chore: alert the user while deleting users who are team owners - [`17db483`](https://github.com/hoppscotch/hoppscotch/commit/17db483a3505bc20b7a6ffea51a71c330359af4b) refactor: leverage helpers - [`8a8cdcf`](https://github.com/hoppscotch/hoppscotch/commit/8a8cdcf78b2f0ba8905eb1111d3f626b6ea9c405) chore: more specific error message while removing Admin status - [`dee7864`](https://github.com/hoppscotch/hoppscotch/commit/dee7864a080ac89afd9fad701c48f5af8618b557) chore: address CR comments - [`986a4b1`](https://github.com/hoppscotch/hoppscotch/commit/986a4b1d549c1662bcff8fefc9433859f53ed2ea) refactor: remove metadata + simplify types - [`d6babae`](https://github.com/hoppscotch/hoppscotch/commit/d6babae291e9b17ced1e3d0d40ee4eb21ceebf05) chore: redirect to users page only in error case after user deletion ### 📊 Changes **6 files changed** (+180 additions, -63 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-sh-admin/locales/en.json` (+3 -0) 📝 `packages/hoppscotch-sh-admin/src/helpers/errors.ts` (+5 -2) ➕ `packages/hoppscotch-sh-admin/src/helpers/userManagement.ts` (+119 -0) 📝 `packages/hoppscotch-sh-admin/src/modules/i18n.ts` (+20 -1) 📝 `packages/hoppscotch-sh-admin/src/pages/users/_id.vue` (+3 -9) 📝 `packages/hoppscotch-sh-admin/src/pages/users/index.vue` (+30 -51) </details> ### 📄 Description ### Description Attempting to delete users who are owners of at least one team from the Admin dashboard is an action that would fail. There wasn't any feedback previously while attempting to delete users from the list view/a user via the profile view. This PR adds an error toast that will be shown during the scenarios mentioned above. ### Changes - Show an error toast while attempting to delete users who are team owners from the list `/users` and profile `/user/_id` views. - Locale entry additions for the case with attempting team owner deletions. - Ensure the singular/plural form of the error toast message is displayed based on the no. of rows selected from the user management list view (`/users` page). - Abstract the user deletion business logic in a helper function `handleUserDeletion()` under `helpers/userManagement.ts`. - New `getI18n()` function exported from the [i18n module](https://github.com/hoppscotch/hoppscotch/pull/3937/files#diff-ed5ce9db1344b536e4856e4957b319d1726fc93762183d6a028dea30023e9882) for use outside components. - At least one Admin is enforced on an instance. Show a more specific error message while attempting to remove the Admin status that would lead to a scenario with no users with Admin privileges. Closes HFE-462. ### Checks - [x] My pull request adheres to the code style of this project - [x] All the tests have passed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:07:29 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4601
No description provided.