Merge pull request #3704 from overleaf/jel-reconfirm-disable-btn

Disable "Make Primary" button when reconfirmation needed

GitOrigin-RevId: df821185ce84c64ed1a8f4d413dd35ef18aa9e0c
This commit is contained in:
Thomas 2021-03-08 15:53:13 +01:00 committed by Copybot
parent 99834f0d7e
commit fc4f71a0c0
3 changed files with 15 additions and 7 deletions

View file

@ -7,7 +7,6 @@ mixin btnMakePrimaryDisabled(tooltip)
div( div(
tooltip=tooltip tooltip=tooltip
tooltip-enable="!ui.isMakingRequest" tooltip-enable="!ui.isMakingRequest"
ng-if="!userEmail.default && (!userEmail.confirmedAt || ui.isMakingRequest) && !institutionAlreadyLinked(userEmail)"
) )
button.btn.btn-sm.btn-success.affiliations-table-inline-action( button.btn.btn-sm.btn-success.affiliations-table-inline-action(
disabled disabled
@ -106,13 +105,16 @@ form.row(
td.affiliations-table-inline-actions td.affiliations-table-inline-actions
// Disabled buttons don't work with tooltips, due to pointer-events: none, // Disabled buttons don't work with tooltips, due to pointer-events: none,
// so create a wrapper for the tooltip // so create a wrapper for the tooltip
span(ng-if="!userEmail.default && (!userEmail.confirmedAt || ui.isMakingRequest) && !institutionAlreadyLinked(userEmail) && !inReconfirmNotificationPeriod(userEmail)")
.affiliations-table-inline-action-disabled-wrapper(ng-if="userEmail.ssoAvailable") .affiliations-table-inline-action-disabled-wrapper(ng-if="userEmail.ssoAvailable")
+btnMakePrimaryDisabled("Please confirm your email by linking to your institutional account before making it the primary email.") +btnMakePrimaryDisabled(translate("please_link_before_making_primary"))
.affiliations-table-inline-action-disabled-wrapper(ng-if="!userEmail.ssoAvailable") .affiliations-table-inline-action-disabled-wrapper(ng-if="!userEmail.ssoAvailable")
+btnMakePrimaryDisabled(translate("please_confirm_your_email_before_making_it_default")) +btnMakePrimaryDisabled(translate("please_confirm_your_email_before_making_it_default"))
.affiliations-table-inline-action-disabled-wrapper(ng-if="inReconfirmNotificationPeriod(userEmail)")
+btnMakePrimaryDisabled(translate("please_reconfirm_your_affiliation_before_making_this_primary"))
button.btn.btn-sm.btn-success.affiliations-table-inline-action( button.btn.btn-sm.btn-success.affiliations-table-inline-action(
tooltip=translate("make_email_primary_description") tooltip=translate("make_email_primary_description")
ng-if="!userEmail.default && (userEmail.confirmedAt && !ui.isMakingRequest)" ng-if="!userEmail.default && (userEmail.confirmedAt && !ui.isMakingRequest) && !inReconfirmNotificationPeriod(userEmail)"
ng-click="setDefaultUserEmail(userEmail)" ng-click="setDefaultUserEmail(userEmail)"
type="button" type="button"
) #{translate("make_primary")} ) #{translate("make_primary")}

View file

@ -282,6 +282,10 @@ export default App.controller('UserAffiliationsController', function(
return promise return promise
} }
$scope.inReconfirmNotificationPeriod = function(emailData) {
return _.get(emailData, ['affiliation', 'inReconfirmNotificationPeriod'])
}
$scope.institutionAlreadyLinked = function(emailData) { $scope.institutionAlreadyLinked = function(emailData) {
const institutionId = const institutionId =
emailData.affiliation && emailData.affiliation &&

View file

@ -336,7 +336,7 @@
"archive_projects": "Archive Projects", "archive_projects": "Archive Projects",
"archive_and_leave_projects": "Archive and Leave Projects", "archive_and_leave_projects": "Archive and Leave Projects",
"about_to_archive_projects": "You are about to archive the following projects:", "about_to_archive_projects": "You are about to archive the following projects:",
"please_confirm_your_email_before_making_it_default": "Please confirm your email before making it the default.", "please_confirm_your_email_before_making_it_default": "Please confirm your email before making it the primary.",
"back_to_editor": "Back to the editor", "back_to_editor": "Back to the editor",
"generic_history_error": "Something went wrong trying to fetch your project's history. If the error persists, please contact us via:", "generic_history_error": "Something went wrong trying to fetch your project's history. If the error persists, please contact us via:",
"unconfirmed": "Unconfirmed", "unconfirmed": "Unconfirmed",
@ -1348,6 +1348,8 @@
"did_you_know_institution_providing_professional": "Did you know that __institutionName__ is providing <0>free __appName__ Professional features</0> to everyone at __institutionName__?", "did_you_know_institution_providing_professional": "Did you know that __institutionName__ is providing <0>free __appName__ Professional features</0> to everyone at __institutionName__?",
"add_email_to_claim_features": "Add an institutional email address to claim your features.", "add_email_to_claim_features": "Add an institutional email address to claim your features.",
"please_change_primary_to_remove": "Please change your primary email in order to remove", "please_change_primary_to_remove": "Please change your primary email in order to remove",
"please_reconfirm_your_affiliation_before_making_this_primary": "Please confirm your affiliation before making this the primary.",
"please_link_before_making_primary": "Please confirm your email by linking to your institutional account before making it the primary email.",
"dropbox_duplicate_project_names": "We detected an update from Dropbox to <0>__projectName__</0>, but you have multiple projects with that name. We are unable to process this, so have unlinked your Dropbox account. Please ensure your project names are unique across your active, archived and trashed projects, and then re-link your Dropbox account.", "dropbox_duplicate_project_names": "We detected an update from Dropbox to <0>__projectName__</0>, but you have multiple projects with that name. We are unable to process this, so have unlinked your Dropbox account. Please ensure your project names are unique across your active, archived and trashed projects, and then re-link your Dropbox account.",
"please_reconfirm_institutional_email": "Please take a moment to confirm your institutional email address or <0>remove it</0> from your account.", "please_reconfirm_institutional_email": "Please take a moment to confirm your institutional email address or <0>remove it</0> from your account.",
"need_to_add_new_primary_before_remove": "You'll need to add a new primary email address before you can remove this one.", "need_to_add_new_primary_before_remove": "You'll need to add a new primary email address before you can remove this one.",