Merge pull request #20514 from overleaf/tm-pending-editor-sorting

Sort members in share modal list by editors > pending > viewers

GitOrigin-RevId: 7e2e3acb69ffaddbddc7bacfe3258e149c717aeb
This commit is contained in:
Thomas 2024-09-25 11:18:51 +02:00 committed by Copybot
parent 267109aa9a
commit 5ebeab3d42

View file

@ -72,6 +72,16 @@ export default function ShareModalBody() {
) )
}, [features, isProjectOwner, members]) }, [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 ( return (
<> <>
{isProjectOwner ? ( {isProjectOwner ? (
@ -88,7 +98,7 @@ export default function ShareModalBody() {
<OwnerInfo /> <OwnerInfo />
{members.map(member => {sortedMembers.map(member =>
isProjectOwner ? ( isProjectOwner ? (
<EditMember <EditMember
key={member._id} key={member._id}