Merge pull request #35607 from overleaf/ii-share-modal-invited-people-count

Exclude project owner from "X people invited" count in share modal

GitOrigin-RevId: 7f914a09401691b6e6f7299637ee695ed37d05c0
This commit is contained in:
ilkin-overleaf
2026-09-17 11:32:05 +00:00
committed by Copybot
parent 873bf5923d
commit f27b19f86a
3 changed files with 24 additions and 7 deletions
@@ -216,7 +216,7 @@ function ProjectAccess({
<div className="d-inline-flex align-items-center h5 m-0 gap-2">
<MaterialIcon type="group" unfilled />
<div className="px-2 fw-normal">
{invitedPeopleCount > 1
{invitedPeopleCount > 0
? t('x_people_invited', { count: invitedPeopleCount })
: t('no_one_invited_yet')}
</div>
@@ -145,10 +145,7 @@ export default function ShareModalBody({
) : (
<ProjectAccess
setIsInvitedPeopleScreen={setIsInvitedPeopleScreen}
// adding +1 for the project owner
invitedPeopleCount={
sortedMembers.length + (invites || []).length + 1
}
invitedPeopleCount={sortedMembers.length + (invites || []).length}
/>
)}
</>
@@ -1128,7 +1128,7 @@ describe('<ShareProjectModal/>', function () {
expect(screen.queryByText('1 person invited')).to.be.null
})
it('shows the invited people count, including the owner, when there are collaborators', async function () {
it('shows the invited people count, excluding the owner, when there are collaborators', async function () {
const members: ProjectMember[] = [
{
_id: 'member-author' as UserId,
@@ -1151,7 +1151,27 @@ describe('<ShareProjectModal/>', function () {
createContextProps({ publicAccessLevel: 'private', members })
)
await screen.findByText('3 people invited')
await screen.findByText('2 people invited')
expect(screen.queryByText('No one invited yet')).to.be.null
})
it('shows "1 person invited" when there is a single collaborator', async function () {
const members: ProjectMember[] = [
{
_id: 'member-author' as UserId,
email: 'member-author@example.com',
privileges: 'readAndWrite',
first_name: 'Member',
last_name: 'Author',
},
]
renderWithEditorContext(
<ShareProjectModal {...modalProps} />,
createContextProps({ publicAccessLevel: 'private', members })
)
await screen.findByText('1 person invited')
expect(screen.queryByText('No one invited yet')).to.be.null
})
})