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
@@ -1293,6 +1293,7 @@
"no_messages_yet": "",
"no_new_commits_in_github": "",
"no_one_has_commented_or_left_any_suggestions_yet": "",
"no_one_invited_yet": "",
"no_one_sharing_link_is_disabled": "",
"no_other_projects_found": "",
"no_pdf_error_explanation": "",
@@ -167,7 +167,9 @@ 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">
{t('x_people_invited', { count: invitedPeopleCount })}
{invitedPeopleCount > 1
? t('x_people_invited', { count: invitedPeopleCount })
: t('no_one_invited_yet')}
</div>
</div>
<OLButton
+1
View File
@@ -1693,6 +1693,7 @@
"no_messages_yet": "No messages yet",
"no_new_commits_in_github": "No new commits in GitHub since last merge.",
"no_one_has_commented_or_left_any_suggestions_yet": "No one has commented or left any suggestions yet.",
"no_one_invited_yet": "No one invited yet",
"no_one_sharing_link_is_disabled": "No one—sharing link is disabled",
"no_other_projects_found": "No other projects found, please create another project first",
"no_other_sessions": "No other sessions active",
@@ -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