[web] Pending invite prevents Viewer being changed to Editor (#19214)

* only count editor invites when disabling editor in dropdown

GitOrigin-RevId: 400215d4817c0146da4f8397fe2007699da0e92b
This commit is contained in:
roo hutton 2024-07-01 09:30:19 +01:00 committed by Copybot
parent 3b29865d87
commit fd50db2341
2 changed files with 7 additions and 2 deletions

View file

@ -26,9 +26,13 @@ export default function ShareModalBody() {
return true return true
} }
const editorInvites = invites.filter(
invite => invite.privileges === 'readAndWrite'
).length
return ( return (
members.filter(member => member.privileges === 'readAndWrite').length + members.filter(member => member.privileges === 'readAndWrite').length +
invites.length < editorInvites <
(features.collaborators ?? 1) (features.collaborators ?? 1)
) )
}, [members, invites, features, isProjectOwner]) }, [members, invites, features, isProjectOwner])
@ -41,6 +45,7 @@ export default function ShareModalBody() {
if (features.collaborators === -1) { if (features.collaborators === -1) {
return false return false
} }
return ( return (
members.filter(member => member.privileges === 'readAndWrite').length > members.filter(member => member.privileges === 'readAndWrite').length >
(features.collaborators ?? 1) (features.collaborators ?? 1)

View file

@ -14,7 +14,7 @@ export type ProjectContextValue = {
rootDocId?: string rootDocId?: string
compiler: string compiler: string
members: ProjectContextMember[] members: ProjectContextMember[]
invites: { _id: UserId }[] invites: ProjectContextMember[]
features: { features: {
collaborators?: number collaborators?: number
compileGroup?: 'alpha' | 'standard' | 'priority' compileGroup?: 'alpha' | 'standard' | 'priority'