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

4032 - Collaborators/User edit final fixes #4187

Merged
merged 9 commits into from
Dec 18, 2024

Conversation

minotogna
Copy link
Member

No description provided.

Comment on lines 19 to 25
return useMemo<Returned>(() => {
const options = Object.keys(RoleName).reduce<Returned>((acc, key) => {
const roles = Users.isAdministrator(user)
? Object.keys(RoleName)
: Users.getRolesAllowedToEdit({ user, countryIso, cycle })

const options = roles.reduce<Returned>((acc, key) => {
if (key !== RoleName.ADMINISTRATOR) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems User.getRolesAllowedToEdit also handles the admin user. It returns every role but administrator. So you can use User.getRolesAllowedToEdit instead of Rolename and then the check at line 25 can be removed too

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch 😃. update pushed

@mergify mergify bot merged commit c36c1ba into 4032-split-user-role-invitation Dec 18, 2024
5 checks passed
@mergify mergify bot deleted the 4032-fixes branch December 18, 2024 13:50
mergify bot added a commit that referenced this pull request Dec 19, 2024
* 4032 - Split database table and data migration (#4036)

* 4032 - UserInvitation type

* 4032 - Update getCreatePublicSchemaDDL

* 4032 - Migration step

* 4032 - update DDL

* 4032 - update migration

* 4032 - restore meta/userRole

* 4032 -  add created at

* disable testing/building

* enable tests

* l_ur.accepted_at as created_at

* fix invitation_uuid

* 4032 -  migrate valid roles and populate created at

* 4032 -  default time stamp from cycle for roles

* 4032 - UserInvitation and UserRole types and integration test (#4054)

* 4032 - meta: userRole, userRoles

* 4032 - test/integration: userInvite update

* 4032 - getCreatePublicSchemaDDL: update users_invitation ddl

* 4032 - userInvitation: isInvitationExpired -> isExpired

* 4032 - userInvitation: require assessmentUuid, userRole: optional cycleUuid

* 4032 - userInvitation: require countryIso

* 4032 - compare role.createdAt with Dates

* 4032 - UserInvitation: invitedByUserUuid required

* 4032 - deepscan

* 4032 - userRoles: add unit test for getLastRole

* 4032 - update hasRoleInAssessment

* 4032 - Create invitation (Backend) (#4055)

* 4032 - AssessmentController: get one with UUID

* 4032 - AssessmentController: get one with UUID

* 4032 - UserRepository: uuid on roles

* 4032 - UserInvitationRepository: create

* 4032 - MailService: update user invite

* 4032 - UserController: invite

* 4032 - AssessmentController: get one with UUID

* 4032 - Remove user invitation related code from getOne user

* 4032 - AssessmentRepository: use type checking for props

* 4032 - Accept invitation and generic fixes (Backend) (#4056)

* 4032 - UserController: update findByInvitation

* 4032 - auth/strategy: Update with new findByInvitation

* 4032 - UserInvitation: Accept

* 4032 - Update UserRole create

* 4032 - Update sendInvitationEmail

* 4032 - Accept and Remove invitation (#4057)

* 4032 - Remove unused UserRoleRepository functions

add todo for update/pendingInvitations

* 4032 - Introduce UserInvitationRepository remove

* 4032 - Remove Invitation API and Controller

* 4032 - Get Invitation API

* 4032 - UserInvitation Repository: renew, getOne, getMany, getCount

* 4032 - User Repository: count, getAdmins, getContacts, getMany, readCountryUsersByRole

* 4032 - Client: Login/Invitation (#4063)

* 4032 - Backend: Get many invitations (#4064)

* 4032 - store/userManagement: use singular endpoint for updating user

* 4032 - backend: get many (pending) invitations

* 4032 - Fix Admin Invitations Expired column (#4068)

* 4032 - UI: Invitations placeholder with invite button (#4069)

* 4032 - Add UserInvitations with Invite button

* 4032 - Move collaborators from FraHome to CountryHome

* 4032 - Introduce UserList element

* 4032 - Introduce UserInvitation and sub elements (#4070)

* 4032 - Add refetch invitations hook (#4071)

* 4032 - Add user invitation info button with Popover (#4072)

* 4032 - Add UserList component and subcomponents (#4074)

* fix typo in query (#4077)

* 4032 -  Update country status change confirm pop up (#4076)

* 4032 - unique class name

* 4032 - deprecate old UserList

* 4032 - Update StatusConfirm: add simple user list

* 4032 - Update StatusConfirm: add simple user list

* Use props extraction

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 4032 - Delete old userlist component (#4078)

* 4032 - Update country summary (#4089)

* 4032 - Country User Summary (#4096)

* 4032 - Country User Summary

* 4032 - rename CountryUserSummaryRepository.createOrReplaceView to getCreateOrReplaceViewCountryUserSummary

* 4032 - remove optional param schemaName

* 4032 - CountryUserSummary view query: remove user_data CTE, rename user_uuid to uuid, include fullname

* 4032 - CountryUserSummary view query: let role and invitation be undefined

* 4032 - Users: Get Many through Country User Summary (#4103)

* 4032 - Country User Summary type

* 4032 - Country User Summary update view

- Include admins
- Include id
- Fix typo in full name column

* 4032 - users/getMany: Initial commit

* 4032 - Separate type UserQueryParams

* 4032 - UserRepository: Use named params for getMany

* 4032 - UserRepository: Use named params for getMany

* 4032 - CountryUserSummary: clean up query

* 4032 - Add indexes for users_invitation, users_role

* 4032 - Rehaul country_user_summary

* 4032 - Users/getMany: fix role filtering for invitations

* 4032 - country_user_summary: Fix admins role column

* 4032 - repository/user: update count

* 4032 - Admin collaborators view (#4112)

* 4032 - Manage Collaborators -> Collaborators

* 4032 - Move and update Admin/UserManagement to AdminCollaborators

* 4032 - useRoutes: use AdminCollaborators

* 4032 - RoleField: Support invitations

* 4032 - deepscan

* 4111 - Fix country filtering

* 4032 - Update Country Collaborators (#4118)

* 4032 - Include Lang column in country_user_summary

* 4032 - Deprecation notice/todo

* 4032 - meta/CountryUserSummaries: getCountryRoleAndInvitation, isInvitation

* 4032 - UserList: Move invite to UserList and remove UserInvitations component

* 4032 - ActionsContainer: Remove unused component

* 4032 - Users: update (invitation) Info column

* 4032 - users/getMany: include lang

* 4032 - Users/Actions: Update hooks

* 4032 - Users/Actions: Update CopyLink

* 4032 - Users/Actions: Update Edit [user]

* 4032 - Users/Actions: Update Remove

* 4032 - Users/Actions: Update Resend

* 4032 - Users: Update Actions

* 4032 - Update Users

* 4032 - Users/getInvitations: Remove unused invitations endpoint (#4119)

* 4032 - Fix Messageboard and country status change recipients (#4128)

* 4032 - Fix Recipients in country status change

* 4032 - Fix MessageBoard

* 4032 - store/userManagement: Update types and deprecate

* 4032 - Fix UUID comparison (#4127)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 4032 - Remove country message board (#4131)

* 4032 - Remove Messageboard, move MessageButton to components

* 4032 - use buttonText -> label

* 4032 - Country message button fix

* 4032 - Fix sections order, hide regions for unpublished areas

* 4032 - Add icon rotate

* 4032 - Darken buttons with type Danger (global change)

* 4032 - MessageButton: Remove margin

* 4032 - CountryHome/Collaborators/ButtonInvite: Update style and use useButtonClassName

* 4032 - MessageButton: Add prop className

* 4032 - Update rule to access messaging on platform

* 4032 - useCanAccessMessaging -> useCanSeeUserActivities

* 4032 - useCanSeeUserActivities move to store/user

* 4032 - components/MessageButton: use useCountryRouteParams

* 4032 - Update collaborators view (#4139)

* 4032 - users/getMany: sort users

- Return users with role first
- Return users with invitation next

* 4032 - Initial commit for UserCard

* 4032 - Add translations

* 4032 - Highlight expired invitation

* 4032 - Remove unused CSS class

* 4032 - Common component Avatar

* 4032 - useActions: Separate hook with return types

* 4032 - useRefetchUsers: Remove unnecessary useMemo and add return type

* 4032 - Add home -prefix for user css classes

* 4032 - TablePaginated: add possibility to sort client side

* 4032 - home/Users: introduce useUserSortFn to sort invited users last

* 4032 - Multi role change (#4141)

* 4032 - db/country_user_summary: Only show pending invitations

* 4032 - be/updateUserRoles: fix updating multiple roles

* 4032 - client/CountryRoles: fix updating multiple roles

* 4032 - fix typo

* 4032 - cloneCycle: Update cloning user roles (#4143)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 4032 - Admin/Collaborators: count: Show correct values per role and total (#4145)

* 4032 - Initial commit for fix admin count

* 4032 - Clean up

* 4032 - Update UI and Generic Fixes (1) (#4150)

* 4032 - fix: hide country message button in regions

* 4032 - Update UI

* 4032 - Rename route and tab: User management -> Collaborators

* 4032 - Minor fixes (2) (#4154)

* 4032 - delete unused file

* 4032 - remove unused parameter

* 4032 - fix invitation count

* 4032 - Minor fixes (3) (#4157)

* 4032 - Reviewer cannot access invitation actions

* 4032 - introduce hook: useCanEditUserActivities

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 4032 - Fix migrations (#4160)

* 4032 - Fix Collaborators page access / edit auth (#4167)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 4032 - UI refactor (#4168)

* 4032 - Remove Users component

* 4032 - refactor ui

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 4032 - refactor Country Home header (#4170)

* 4032 - refactor Country Home header

* 4032 - fix message count

* 4032 - improve ui

* 4032 - Dashboard UI (#4174)

* 4032 - Dashboard UI

* 4032 - update users sort fn

* 4032 - update user role label

* 4032 - refactor table paginated sort

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 4032 - Disabled users toggle (#4177)

* 4032 - Fix inconsistencies in Admin/Collaborators

* 4032 - Admin collaborators: Filter by disabled

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 4032 - Fix User status (#4179)

* 4032 - Refactor/Fix Users.getMany (#4180)

* 4032 - Refactor users.getMany filters logic

* 4032 - Fix users results

* 4032 - Fix ts-ignore

* 4032 - Fix deep scan

* 4032 - 4156 - Refactor Atlantis countries usage (#4181)

* 4032 - useUserCountryISOs: hide atlantis countries in published views

* 4032 - remove isAtlantisAllowed

* 4156 - update .env.template

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 4032 - fix export (#4183)

* 4032 - Collaborators Grouped UI (#4184)

* 4032 - Ui Collaborators grouped

* 4032 - Collaborators Grouped UI

* 4032 - Collaborators/User edit final fixes (#4187)

* 4032 - Collaborators/User edit final fixes

* 4032 - add user i18n

* 4032 - update sections collaborator i18n

* 4032 - update roles logic in /UserCountryRoleSelector/hooks/useOptions

* 4032 - fix panEuropean description labels

* 4032 - fix clone cycle

* 4032 - update skeleton duration

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Mino Togna <[email protected]>
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.

2 participants