Просмотр исходного кода

Merge pull request #917 from sharelatex/hb-confirm-email-notification

Add notification to confirm unconfirmed emails
Hugh O'Brien 8 лет назад
Родитель
Сommit
18e706c4b2

+ 18 - 0
services/web/app/views/project/list/notifications.pug

@@ -82,3 +82,21 @@ 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"
+		)
+			.row
+				.col-xs-12
+					.alert.alert-warning
+						.notification_inner
+							| Please confirm your email {{userEmail.email}} by clicking on the link in the confirmation email 
+							a(
+								href,
+								ng-click="resendConfirmationEmail(userEmail)"
+							) (#{translate('resend_confirmation_email')})

+ 13 - 0
services/web/public/coffee/main/project-list/notifications-controller.coffee

@@ -53,3 +53,16 @@ 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 = []
+
+		_getUserEmails = () ->
+				UserAffiliationsDataService
+					.getUserEmails().then (emails) -> 
+						$scope.userEmails = emails
+		_getUserEmails()
+
+		$scope.resendConfirmationEmail = (userEmail) ->
+			UserAffiliationsDataService
+				.resendConfirmationEmail userEmail.email