add notification to confirm unconfirmed emails

This commit is contained in:
Tim Alby 2018-10-11 15:39:54 +01:00
parent 1256d29af9
commit 6f63cd7ca0
3 changed files with 51 additions and 0 deletions

View file

@ -82,3 +82,30 @@ span(ng-controller="NotificationsController").userNotifications
button(ng-click="dismiss(notification)").close.pull-right button(ng-click="dismiss(notification)").close.pull-right
span(aria-hidden="true") × span(aria-hidden="true") ×
span.sr-only #{translate("close")} span.sr-only #{translate("close")}
ul.list-unstyled.notifications-list(
ng-controller="EmailNotificationController",
ng-cloak
)
li.notification_entry(
ng-repeat="userEmail in userEmails",
ng-if="!userEmail.confirmedAt && !userEmail.hide"
)
.row
.col-xs-12
.alert.alert-warning
.notification_inner(
ng-if="!userEmail.confirmationInflight"
)
| #{translate("please_confirm_email", {emailAddress: "{{ userEmail.email }}"})}
|
a(
href
ng-click="resendConfirmationEmail(userEmail)"
) (#{translate('resend_confirmation_email')})
.notification_inner(
ng-if="userEmail.confirmationInflight"
)
i.fa.fa-spinner.fa-spin
|
| #{translate('resending_confirmation_email')}…

View file

@ -53,3 +53,24 @@ define [
localStorage('overleaf_v1_notification_hidden_at', Date.now()) localStorage('overleaf_v1_notification_hidden_at', Date.now())
else else
localStorage('overleaf_v1_notification_hidden_at', null) localStorage('overleaf_v1_notification_hidden_at', null)
App.controller "EmailNotificationController", ($scope, $http, UserAffiliationsDataService) ->
$scope.userEmails = []
for userEmail in $scope.userEmails
userEmail.hide = false
_getUserEmails = () ->
UserAffiliationsDataService
.getUserEmails().then (emails) ->
$scope.userEmails = emails
$scope.$emit "project-list:notifications-received"
_getUserEmails()
$scope.resendConfirmationEmail = (userEmail) ->
userEmail.confirmationInflight = true
UserAffiliationsDataService
.resendConfirmationEmail userEmail.email
.then () ->
userEmail.hide = true
userEmail.confirmationInflight = false
$scope.$emit "project-list:notifications-received"

View file

@ -38,6 +38,9 @@ define [
recalculateProjectListHeight() recalculateProjectListHeight()
$scope.$apply() $scope.$apply()
$scope.$on "project-list:notifications-received", () ->
$scope.$applyAsync () -> recalculateProjectListHeight()
# Allow tags to be accessed on projects as well # Allow tags to be accessed on projects as well
projectsById = {} projectsById = {}
for project in $scope.projects for project in $scope.projects