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

Show "No one invited yet" instead of "1 person invited" for solo projects

GitOrigin-RevId: 0423b507e0574dc5a381cbe4044912a25af7a3f0
This commit is contained in:
MoxAmber
2026-06-18 08:06:48 +00:00
committed by Copybot
parent a7a3ccdb71
commit ad9b28af18
4 changed files with 51 additions and 1 deletions
@@ -1069,6 +1069,52 @@ describe('<ShareProjectModal/>', function () {
await screen.findByText('Anyone in your group with the link')
})
describe('invited people count', function () {
beforeEach(function () {
fetchMock.get(
`/project/${shareModalProjectDefaults._id}/sharing-link`,
404
)
})
it('shows "No one invited yet" when the owner is the only person', async function () {
renderWithEditorContext(
<ShareProjectModal {...modalProps} />,
createContextProps({ publicAccessLevel: 'private' })
)
await screen.findByText('No one invited yet')
expect(screen.queryByText('1 person invited')).to.be.null
})
it('shows the invited people count, including the owner, when there are collaborators', async function () {
const members: ProjectMember[] = [
{
_id: 'member-author' as UserId,
email: 'member-author@example.com',
privileges: 'readAndWrite',
first_name: 'Member',
last_name: 'Author',
},
{
_id: 'member-viewer' as UserId,
email: 'member-viewer@example.com',
privileges: 'readOnly',
first_name: 'Member',
last_name: 'Viewer',
},
]
renderWithEditorContext(
<ShareProjectModal {...modalProps} />,
createContextProps({ publicAccessLevel: 'private', members })
)
await screen.findByText('3 people invited')
expect(screen.queryByText('No one invited yet')).to.be.null
})
})
describe('copy link button', function () {
let clipboardWriteTextStub: sinon.SinonStub