Merge pull request #942 from sharelatex/pr-dismiss-email-confirmation

Email confirmation notification UI fixes
This commit is contained in:
Timothée Alby 2018-10-15 14:49:06 +02:00 committed by GitHub
commit c41fb5c9f4
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
span(aria-hidden="true") ×
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())
else
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()
$scope.$apply()
$scope.$on "project-list:notifications-received", () ->
$scope.$applyAsync () -> recalculateProjectListHeight()
# Allow tags to be accessed on projects as well
projectsById = {}
for project in $scope.projects