From 54c471bc1cc5fb1ffcfd5482d6d6219c8127cb6e Mon Sep 17 00:00:00 2001 From: Jessica Lawshe Date: Mon, 22 Feb 2021 09:01:09 -0600 Subject: [PATCH] Merge pull request #3629 from overleaf/jel-ui-reconfirm-dash Show reconfirm notification on the dash GitOrigin-RevId: 4640513a299853a63c5f36b3e11b41ee66af61de --- .../app/src/Features/Project/ProjectController.js | 4 ++++ .../app/views/_mixins/reconfirm_affiliation.pug | 3 +-- services/web/app/views/project/list.pug | 2 +- .../web/app/views/project/list/notifications.pug | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index 77982ab0a5..03d8c1c8cf 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -1,3 +1,4 @@ +const _ = require('lodash') const Path = require('path') const OError = require('@overleaf/o-error') const fs = require('fs') @@ -476,7 +477,9 @@ const ProjectController = { } // Institution SSO Notifications + let reconfirmedViaSAML if (Features.hasFeature('saml')) { + reconfirmedViaSAML = _.get(req.session, ['saml', 'reconfirmed']) const samlSession = req.session.saml // Notification: SSO Available const linkedInstitutionIds = [] @@ -581,6 +584,7 @@ const ProjectController = { userAffiliations, userEmails, hasSubscription: results.hasSubscription, + reconfirmedViaSAML, zipFileSizeLimit: Settings.maxUploadSize } diff --git a/services/web/app/views/_mixins/reconfirm_affiliation.pug b/services/web/app/views/_mixins/reconfirm_affiliation.pug index 1a00999eed..8d6ce5f9a1 100644 --- a/services/web/app/views/_mixins/reconfirm_affiliation.pug +++ b/services/web/app/views/_mixins/reconfirm_affiliation.pug @@ -10,8 +10,7 @@ mixin reconfirmAffiliationNotification(location) ng-disabled="ui.isMakingRequest" ) #{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' | !{translate('please_reconfirm_institutional_email', {}, [{ name: 'span' }])} diff --git a/services/web/app/views/project/list.pug b/services/web/app/views/project/list.pug index c5d4da0231..600a0986d0 100644 --- a/services/web/app/views/project/list.pug +++ b/services/web/app/views/project/list.pug @@ -5,7 +5,7 @@ block vars block content 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"). window.data = JSON.parse(document.querySelector("#data").text); diff --git a/services/web/app/views/project/list/notifications.pug b/services/web/app/views/project/list/notifications.pug index c83c0ed721..6cf66dcf7c 100644 --- a/services/web/app/views/project/list/notifications.pug +++ b/services/web/app/views/project/list/notifications.pug @@ -1,3 +1,5 @@ +include ../../_mixins/reconfirm_affiliation + .user-notifications(ng-controller="NotificationsController") include ./unsupported-browser @@ -215,6 +217,19 @@ div(ng-if="!userEmail.confirmationInflight && userEmail.error" aria-live="polite") | #{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') if settings.enableSubscriptions && !hasSubscription && !hasPaidAffiliation ul.list-unstyled(