From 5ebeab3d42ecdecabd0e3ae6a4f5d4fe476de052 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 25 Sep 2024 11:18:51 +0200 Subject: [PATCH] Merge pull request #20514 from overleaf/tm-pending-editor-sorting Sort members in share modal list by editors > pending > viewers GitOrigin-RevId: 7e2e3acb69ffaddbddc7bacfe3258e149c717aeb --- .../restricted-link-sharing/share-modal-body.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/share-modal-body.tsx b/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/share-modal-body.tsx index 17de897e29..aabb6f3628 100644 --- a/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/share-modal-body.tsx +++ b/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/share-modal-body.tsx @@ -72,6 +72,16 @@ export default function ShareModalBody() { ) }, [features, isProjectOwner, members]) + const sortedMembers = useMemo(() => { + return [ + ...members.filter(member => member.privileges === 'readAndWrite'), + ...members.filter(member => member.pendingEditor), + ...members.filter( + member => !member.pendingEditor && member.privileges !== 'readAndWrite' + ), + ] + }, [members]) + return ( <> {isProjectOwner ? ( @@ -88,7 +98,7 @@ export default function ShareModalBody() { - {members.map(member => + {sortedMembers.map(member => isProjectOwner ? (