From 315fd044005403a1fa810ba7257d52555c0847e1 Mon Sep 17 00:00:00 2001 From: Philippe Rolet Date: Thu, 19 Oct 2023 18:07:35 +0200 Subject: [PATCH] Fixes on member page (#2202) - Admin cannot edit self - Invite link can be removed with empty string - Invite settings show with no domain --- front/pages/w/[wId]/members/index.tsx | 80 ++++++++++++++------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/front/pages/w/[wId]/members/index.tsx b/front/pages/w/[wId]/members/index.tsx index 02826f58acd6..16397776a30f 100644 --- a/front/pages/w/[wId]/members/index.tsx +++ b/front/pages/w/[wId]/members/index.tsx @@ -27,7 +27,7 @@ import { RoleType, } from "@app/lib/auth"; import { useMembers, useWorkspaceInvitations } from "@app/lib/swr"; -import { isEmailValid } from "@app/lib/utils"; +import { classNames, isEmailValid } from "@app/lib/utils"; import { MembershipInvitationType } from "@app/types/membership_invitation"; import { UserType, WorkspaceType } from "@app/types/user"; @@ -102,49 +102,49 @@ export default function WorkspaceAdmin({ Allow any person with the right email domain name ( @company.com) to signup and join your workspace. - {inviteLink ? ( - <> + <> + {inviteLink && ( Invitation link is activated for domain{" "} {`@${owner.allowedDomain}`}. -
-
- +
+ +
+
+
+
-
-
-
-
-
+
+
- - ) : ( -
- )} +
+ @@ -259,6 +259,7 @@ export default function WorkspaceAdmin({ } className="transition-color flex cursor-pointer items-center justify-center gap-3 border-t border-structure-200 p-2 text-xs duration-200 hover:bg-action-50 sm:text-sm" onClick={() => { + if (user?.id === item.id) return; // no action on self if (isInvitation(item)) setInvitationToRevoke(item); else setChangeRoleMember(item); /* Delay to let react re-render the modal before opening it otherwise no animation transition */ @@ -307,7 +308,10 @@ export default function WorkspaceAdmin({
@@ -464,7 +468,7 @@ function InviteSettingsModal({ setAllowedDomainError(""); } else { // eslint-disable-next-line no-useless-escape - if (!domainInput.match(/^[a-z0-9\.\-]+$/)) { + if (!domainInput.match(/^[a-z0-9\.\-]*$/)) { setAllowedDomainError("Allowed domain must be a valid domain name."); valid = false; } else {