Merge pull request #3629 from overleaf/jel-ui-reconfirm-dash

Show reconfirm notification on the dash

GitOrigin-RevId: 4640513a299853a63c5f36b3e11b41ee66af61de
This commit is contained in:
Jessica Lawshe 2021-02-22 09:01:09 -06:00 committed by Copybot
parent ddb6163b65
commit 54c471bc1c
4 changed files with 21 additions and 3 deletions

View file

@ -1,3 +1,4 @@
const _ = require('lodash')
const Path = require('path') const Path = require('path')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const fs = require('fs') const fs = require('fs')
@ -476,7 +477,9 @@ const ProjectController = {
} }
// Institution SSO Notifications // Institution SSO Notifications
let reconfirmedViaSAML
if (Features.hasFeature('saml')) { if (Features.hasFeature('saml')) {
reconfirmedViaSAML = _.get(req.session, ['saml', 'reconfirmed'])
const samlSession = req.session.saml const samlSession = req.session.saml
// Notification: SSO Available // Notification: SSO Available
const linkedInstitutionIds = [] const linkedInstitutionIds = []
@ -581,6 +584,7 @@ const ProjectController = {
userAffiliations, userAffiliations,
userEmails, userEmails,
hasSubscription: results.hasSubscription, hasSubscription: results.hasSubscription,
reconfirmedViaSAML,
zipFileSizeLimit: Settings.maxUploadSize zipFileSizeLimit: Settings.maxUploadSize
} }

View file

@ -10,8 +10,7 @@ mixin reconfirmAffiliationNotification(location)
ng-disabled="ui.isMakingRequest" ng-disabled="ui.isMakingRequest"
) #{translate("confirm_affiliation")} ) #{translate("confirm_affiliation")}
| !{translate("are_you_still_at", {institutionName: '{{userEmail.affiliation.institution.name}}'}, ['strong'])} | !{translate("are_you_still_at", {institutionName: '{{userEmail.affiliation.institution.name}}'}, ['strong'])} 
|  
if location == '/user/settings' if location == '/user/settings'
| !{translate('please_reconfirm_institutional_email', {}, [{ name: 'span' }])} | !{translate('please_reconfirm_institutional_email', {}, [{ name: 'span' }])}

View file

@ -5,7 +5,7 @@ block vars
block content block content
script#data(type="application/json"). script#data(type="application/json").
!{StringHelper.stringifyJsonForScript({ projects, tags, notifications, notificationsInstitution, userAffiliations, userEmails })} !{StringHelper.stringifyJsonForScript({ projects, tags, notifications, notificationsInstitution, userAffiliations, userEmails, allInReconfirmNotificationPeriods, reconfirmedViaSAML })}
script(type="text/javascript"). script(type="text/javascript").
window.data = JSON.parse(document.querySelector("#data").text); window.data = JSON.parse(document.querySelector("#data").text);

View file

@ -1,3 +1,5 @@
include ../../_mixins/reconfirm_affiliation
.user-notifications(ng-controller="NotificationsController") .user-notifications(ng-controller="NotificationsController")
include ./unsupported-browser include ./unsupported-browser
@ -215,6 +217,19 @@
div(ng-if="!userEmail.confirmationInflight && userEmail.error" aria-live="polite") div(ng-if="!userEmail.confirmationInflight && userEmail.error" aria-live="polite")
| #{translate('generic_something_went_wrong')} | #{translate('generic_something_went_wrong')}
ui.list-unstyled(ng-controller="UserAffiliationsReconfirmController")
li.notification-entry(
ng-repeat="userEmail in allInReconfirmNotificationPeriods"
)
.alert.alert-info()
+reconfirmAffiliationNotification('/project')
li.notification-entry(
ng-repeat="userEmail in userEmails"
ng-if="userEmail.samlIdentifier && userEmail.samlIdentifier.providerId === reconfirmedViaSAML"
)
+reconfirmedAffiliationNotification()
- var hasPaidAffiliation = userAffiliations.some(affiliation => affiliation.licence && affiliation.licence !== 'free') - var hasPaidAffiliation = userAffiliations.some(affiliation => affiliation.licence && affiliation.licence !== 'free')
if settings.enableSubscriptions && !hasSubscription && !hasPaidAffiliation if settings.enableSubscriptions && !hasSubscription && !hasPaidAffiliation
ul.list-unstyled( ul.list-unstyled(