diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-07 21:09:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-07 21:09:58 +0000 |
commit | 919e3e3cd83e76dba137ef9bcc4746214c2085ff (patch) | |
tree | 4e9799b9c6193583896ea1f05137815ff9782796 /app/controllers/import/github_controller.rb | |
parent | 6cae2159b8ce1e84fad48f3dbd5368995cbd87b1 (diff) | |
download | gitlab-ce-919e3e3cd83e76dba137ef9bcc4746214c2085ff.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/import/github_controller.rb')
-rw-r--r-- | app/controllers/import/github_controller.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb index 76772a72865..0bee1faccf5 100644 --- a/app/controllers/import/github_controller.rb +++ b/app/controllers/import/github_controller.rb @@ -93,6 +93,23 @@ class Import::GithubController < Import::BaseController end end + def cancel_all + projects_to_cancel = Project.imported_from(provider_name).created_by(current_user).is_importing + + canceled = projects_to_cancel.map do |project| + # #reset is called to make sure project was not finished/canceled brefore calling service + result = Import::Github::CancelProjectImportService.new(project.reset, current_user).execute + + { + id: project.id, + status: result[:status], + error: result[:message] + }.compact + end + + render json: canceled + end + protected override :importable_repos |