mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-10 06:39:01 +02:00
Merge pull request #28522 from overleaf/ii-domain-capture-create-user-notification
[web] Success message when linking to group with domain capture GitOrigin-RevId: 2abf29b486da5043c9f207b8f1f741a3c3ee54ab
This commit is contained in:
@@ -319,7 +319,9 @@ async function projectListPage(req, res, next) {
|
||||
institutionName:
|
||||
samlSession.linked.universityName ||
|
||||
samlSession.linked.providerName,
|
||||
templateKey: 'notification_institution_sso_linked',
|
||||
templateKey: samlSession.domainCaptureEnabled
|
||||
? 'notification_group_sso_linked'
|
||||
: 'notification_institution_sso_linked',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
"access_edit_your_projects": "",
|
||||
"access_levels_changed": "",
|
||||
"account_billed_manually": "",
|
||||
"account_has_been_link_to_group_account": "",
|
||||
"account_has_been_link_to_institution_account": "",
|
||||
"account_has_past_due_invoice_change_plan_warning": "",
|
||||
"account_help": "",
|
||||
|
||||
+15
@@ -88,6 +88,21 @@ function Institution() {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{templateKey === 'notification_group_sso_linked' && (
|
||||
<Notification
|
||||
type="info"
|
||||
onDismiss={() => id && handleDismiss(id)}
|
||||
content={
|
||||
<Trans
|
||||
i18nKey="account_has_been_link_to_group_account"
|
||||
components={{ b: <b /> }}
|
||||
values={{ appName, email, institutionName }}
|
||||
shouldUnescape
|
||||
tOptions={{ interpolation: { escapeValue: true } }}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{templateKey === 'notification_institution_sso_non_canonical' && (
|
||||
<Notification
|
||||
type="warning"
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
"account": "Account",
|
||||
"account_already_managed": "Your account is already managed.",
|
||||
"account_billed_manually": "Account billed manually",
|
||||
"account_has_been_link_to_group_account": "Your __appName__ account on <b>__email__</b> has been linked to your <b>__institutionName__</b> account.",
|
||||
"account_has_been_link_to_institution_account": "Your __appName__ account on <b>__email__</b> has been linked to your <b>__institutionName__</b> institutional account.",
|
||||
"account_has_past_due_invoice_change_plan_warning": "Your account currently has a past due invoice. You will not be able to change your plan until this is resolved.",
|
||||
"account_help": "Account and help",
|
||||
|
||||
@@ -509,8 +509,43 @@ describe('<UserNotifications />', function () {
|
||||
render(<Institution />)
|
||||
fetchMock.delete(`/notifications/${institution._id}`, 200)
|
||||
|
||||
screen.getByRole('alert')
|
||||
screen.getByText(/has been linked to your/i)
|
||||
const notificationEl = screen.getByRole('alert')
|
||||
expect(notificationEl.textContent).to.match(
|
||||
new RegExp(
|
||||
`your Overleaf account on ${notificationsInstitution.email} ` +
|
||||
`has been linked to your ${notificationsInstitution.institutionName} ` +
|
||||
`institutional account.`,
|
||||
'i'
|
||||
)
|
||||
)
|
||||
|
||||
const closeBtn = screen.getByRole('button', { name: /close/i })
|
||||
fireEvent.click(closeBtn)
|
||||
|
||||
expect(fetchMock.callHistory.called()).to.be.true
|
||||
expect(screen.queryByRole('alert')).to.be.null
|
||||
})
|
||||
|
||||
it('shows sso linked to group with domain capture enabled', function () {
|
||||
const institution: DeepPartial<InstitutionType> = {
|
||||
_id: 1,
|
||||
templateKey: 'notification_group_sso_linked',
|
||||
}
|
||||
window.metaAttributesCache.set('ol-notificationsInstitution', [
|
||||
{ ...notificationsInstitution, ...institution },
|
||||
])
|
||||
render(<Institution />)
|
||||
fetchMock.delete(`/notifications/${institution._id}`, 200)
|
||||
|
||||
const notificationEl = screen.getByRole('alert')
|
||||
expect(notificationEl.textContent).to.match(
|
||||
new RegExp(
|
||||
`your Overleaf account on ${notificationsInstitution.email} ` +
|
||||
`has been linked to your ${notificationsInstitution.institutionName} ` +
|
||||
`account.`,
|
||||
'i'
|
||||
)
|
||||
)
|
||||
|
||||
const closeBtn = screen.getByRole('button', { name: /close/i })
|
||||
fireEvent.click(closeBtn)
|
||||
|
||||
@@ -570,7 +570,25 @@ describe('ProjectListController', function () {
|
||||
}
|
||||
ctx.ProjectListController.projectListPage(ctx.req, ctx.res)
|
||||
})
|
||||
it('should show a linked group notification via domain capture', function (ctx) {
|
||||
it('should show a group linked notification when domain capture enabled', function (ctx) {
|
||||
ctx.req.session.saml = {
|
||||
institutionEmail: ctx.institutionEmail,
|
||||
linked: {
|
||||
hasEntitlement: false,
|
||||
universityName: ctx.institutionName,
|
||||
},
|
||||
domainCaptureEnabled: true,
|
||||
}
|
||||
ctx.res.render = (pageName, opts) => {
|
||||
expect(opts.notificationsInstitution).to.deep.include({
|
||||
email: ctx.institutionEmail,
|
||||
institutionName: ctx.institutionName,
|
||||
templateKey: 'notification_group_sso_linked',
|
||||
})
|
||||
}
|
||||
ctx.ProjectListController.projectListPage(ctx.req, ctx.res)
|
||||
})
|
||||
it('should show a success notification when joining group via domain capture page', function (ctx) {
|
||||
ctx.req.session.saml = {
|
||||
linkedGroup: true,
|
||||
universityName: ctx.institutionName,
|
||||
|
||||
Reference in New Issue
Block a user