|
|
@@ -1,32 +1,21 @@
|
|
|
-/* eslint-disable
|
|
|
- max-len,
|
|
|
- no-return-assign,
|
|
|
- no-undef,
|
|
|
-*/
|
|
|
-// TODO: This file was created by bulk-decaffeinate.
|
|
|
-// Fix any style issues and re-enable lint.
|
|
|
-/*
|
|
|
- * decaffeinate suggestions:
|
|
|
- * DS101: Remove unnecessary use of Array.from
|
|
|
- * DS102: Remove unnecessary code created because of implicit returns
|
|
|
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
- */
|
|
|
+const ExposedSettings = window.ExposedSettings
|
|
|
+
|
|
|
define(['base'], function(App) {
|
|
|
App.controller('NotificationsController', function($scope, $http) {
|
|
|
- for (let notification of Array.from($scope.notifications)) {
|
|
|
+ for (let notification of $scope.notifications || []) {
|
|
|
notification.hide = false
|
|
|
}
|
|
|
|
|
|
$scope.samlInitPath = ExposedSettings.samlInitPath
|
|
|
|
|
|
- return ($scope.dismiss = notification =>
|
|
|
+ $scope.dismiss = notification =>
|
|
|
$http({
|
|
|
url: `/notifications/${notification._id}`,
|
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
|
'X-Csrf-Token': window.csrfToken
|
|
|
}
|
|
|
- }).then(() => (notification.hide = true)))
|
|
|
+ }).then(() => (notification.hide = true))
|
|
|
})
|
|
|
|
|
|
App.controller('ProjectInviteNotificationController', function(
|
|
|
@@ -37,7 +26,7 @@ define(['base'], function(App) {
|
|
|
$scope.projectName = $scope.notification.messageOpts.projectName
|
|
|
$scope.userName = $scope.notification.messageOpts.userName
|
|
|
|
|
|
- return ($scope.accept = function() {
|
|
|
+ $scope.accept = function() {
|
|
|
$scope.notification.inflight = true
|
|
|
return $http({
|
|
|
url: `/project/${
|
|
|
@@ -64,38 +53,10 @@ define(['base'], function(App) {
|
|
|
.finally(() => {
|
|
|
$scope.notification.inflight = false
|
|
|
})
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
- App.controller('OverleafV2NotificationController', function(
|
|
|
- $scope,
|
|
|
- localStorage
|
|
|
- ) {
|
|
|
- $scope.visible = !localStorage('overleaf_v2_2_notification_hidden_at')
|
|
|
-
|
|
|
- return ($scope.dismiss = function() {
|
|
|
- $scope.visible = false
|
|
|
- return localStorage('overleaf_v2_2_notification_hidden_at', Date.now())
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
- App.controller('OverleafV1NotificationController', function(
|
|
|
- $scope,
|
|
|
- localStorage
|
|
|
- ) {
|
|
|
- $scope.visible = !localStorage('overleaf_v1_notification_hidden_at')
|
|
|
-
|
|
|
- return ($scope.toggle = function() {
|
|
|
- $scope.visible = !$scope.visible
|
|
|
- if (!$scope.visible) {
|
|
|
- return localStorage('overleaf_v1_notification_hidden_at', Date.now())
|
|
|
- } else {
|
|
|
- return localStorage('overleaf_v1_notification_hidden_at', null)
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
- return App.controller('EmailNotificationController', function(
|
|
|
+ App.controller('EmailNotificationController', function(
|
|
|
$scope,
|
|
|
$http,
|
|
|
UserAffiliationsDataService
|
|
|
@@ -125,26 +86,26 @@ define(['base'], function(App) {
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
- for (let userEmail of Array.from($scope.userEmails)) {
|
|
|
+ for (let userEmail of $scope.userEmails) {
|
|
|
userEmail.hide = false
|
|
|
}
|
|
|
|
|
|
const _getUserEmails = () =>
|
|
|
UserAffiliationsDataService.getUserEmails().then(function(emails) {
|
|
|
$scope.userEmails = emails
|
|
|
- return $scope.$emit('project-list:notifications-received')
|
|
|
+ $scope.$emit('project-list:notifications-received')
|
|
|
})
|
|
|
_getUserEmails()
|
|
|
|
|
|
- return ($scope.resendConfirmationEmail = function(userEmail) {
|
|
|
+ $scope.resendConfirmationEmail = function(userEmail) {
|
|
|
userEmail.confirmationInflight = true
|
|
|
return UserAffiliationsDataService.resendConfirmationEmail(
|
|
|
userEmail.email
|
|
|
).then(function() {
|
|
|
userEmail.hide = true
|
|
|
userEmail.confirmationInflight = false
|
|
|
- return $scope.$emit('project-list:notifications-received')
|
|
|
+ $scope.$emit('project-list:notifications-received')
|
|
|
})
|
|
|
- })
|
|
|
+ }
|
|
|
})
|
|
|
})
|