-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move check_and_remove_repositories to a concern
It's only used in SourceProjectController and SourceProjectMetaController.
- Loading branch information
1 parent
47f15b6
commit 4503919
Showing
4 changed files
with
15 additions
and
8 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/api/app/controllers/concerns/check_and_remove_repositories.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module CheckAndRemoveRepositories | ||
extend ActiveSupport::Concern | ||
|
||
def check_and_remove_repositories!(repositories, opts) | ||
result = Project.check_repositories(repositories) unless opts[:force] | ||
raise Source::Errors::RepoDependency, result[:error] if !opts[:force] && result[:error] | ||
|
||
result = Project.remove_repositories(repositories, opts) | ||
raise Source::Errors::ChangeProjectNoPermission, result[:error] if !opts[:force] && result[:error] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters