Merge pull request #1477 from sharelatex/as-confirm-quick-action-archive-leave

Confirm archive or leave when clicking quick action buttons

GitOrigin-RevId: 95d728f22284bab17887a5ac7bc7461d501db7a2
This commit is contained in:
Chrystal Maria Griffiths 2019-02-15 13:16:21 +00:00 committed by sharelatex
parent b1c40d2c58
commit 96f283e2c6

View file

@ -504,16 +504,22 @@ define(['base'], function(App) {
})
}
$scope.openArchiveProjectsModal = function() {
const modalInstance = $modal.open({
$scope.createArchiveProjectsModal = function(projects) {
return $modal.open({
templateUrl: 'deleteProjectsModalTemplate',
controller: 'DeleteProjectsModalController',
resolve: {
projects() {
return $scope.getSelectedProjects()
return projects
}
}
})
}
$scope.openArchiveProjectsModal = function() {
const modalInstance = $scope.createArchiveProjectsModal(
$scope.getSelectedProjects()
)
event_tracking.send(
'project-list-page-interaction',
'project action',
@ -529,6 +535,12 @@ define(['base'], function(App) {
$scope.archiveOrLeaveProjects = function(projects) {
for (let project of projects) {
$scope.archiveOrLeaveProject(project)
}
$scope.updateVisibleProjects()
}
$scope.archiveOrLeaveProject = function(project) {
if (project.accessLevel === 'owner') {
project.archived = true
queuedHttp({
@ -551,9 +563,6 @@ define(['base'], function(App) {
}
}
return $scope.updateVisibleProjects()
}
$scope.openDeleteProjectsModal = function() {
const modalInstance = $modal.open({
templateUrl: 'deleteProjectsModalTemplate',
@ -750,7 +759,10 @@ define(['base'], function(App) {
$scope.archiveOrLeave = function(e) {
e.stopPropagation()
return $scope.archiveOrLeaveProjects([$scope.project])
$scope.createArchiveProjectsModal([$scope.project]).result.then(() => {
$scope.archiveOrLeaveProject($scope.project)
$scope.updateVisibleProjects()
})
}
$scope.restore = function(e) {