diff options
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/build_action_entity.rb | 5 | ||||
-rw-r--r-- | app/serializers/build_artifact_entity.rb | 15 | ||||
-rw-r--r-- | app/serializers/build_details_entity.rb | 10 | ||||
-rw-r--r-- | app/serializers/commit_entity.rb | 10 | ||||
-rw-r--r-- | app/serializers/deployment_entity.rb | 5 | ||||
-rw-r--r-- | app/serializers/environment_entity.rb | 20 | ||||
-rw-r--r-- | app/serializers/issue_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/merge_request_entity.rb | 27 | ||||
-rw-r--r-- | app/serializers/pipeline_entity.rb | 13 | ||||
-rw-r--r-- | app/serializers/project_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/runner_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/stage_entity.rb | 6 |
12 files changed, 30 insertions, 87 deletions
diff --git a/app/serializers/build_action_entity.rb b/app/serializers/build_action_entity.rb index 301b718d060..f2d76a8ad81 100644 --- a/app/serializers/build_action_entity.rb +++ b/app/serializers/build_action_entity.rb @@ -6,10 +6,7 @@ class BuildActionEntity < Grape::Entity end expose :path do |build| - play_namespace_project_job_path( - build.project.namespace, - build.project, - build) + play_project_job_path(build.project, build) end expose :playable?, as: :playable diff --git a/app/serializers/build_artifact_entity.rb b/app/serializers/build_artifact_entity.rb index cb55c98f7c6..6e0e33bc09b 100644 --- a/app/serializers/build_artifact_entity.rb +++ b/app/serializers/build_artifact_entity.rb @@ -9,24 +9,15 @@ class BuildArtifactEntity < Grape::Entity expose :artifacts_expire_at, as: :expire_at expose :path do |job| - download_namespace_project_job_artifacts_path( - project.namespace, - project, - job) + download_project_job_artifacts_path(project, job) end expose :keep_path, if: -> (*) { job.has_expiring_artifacts? } do |job| - keep_namespace_project_job_artifacts_path( - project.namespace, - project, - job) + keep_project_job_artifacts_path(project, job) end expose :browse_path do |job| - browse_namespace_project_job_artifacts_path( - project.namespace, - project, - job) + browse_project_job_artifacts_path(project, job) end private diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb index eeb5399aa8b..20f9938f038 100644 --- a/app/serializers/build_details_entity.rb +++ b/app/serializers/build_details_entity.rb @@ -7,7 +7,7 @@ class BuildDetailsEntity < JobEntity expose :erased_by, if: -> (*) { build.erased? }, using: UserEntity expose :erase_path, if: -> (*) { build.erasable? && can?(current_user, :update_build, project) } do |build| - erase_namespace_project_job_path(project.namespace, project, build) + erase_project_job_path(project, build) end expose :merge_request, if: -> (*) { can?(current_user, :read_merge_request, build.merge_request) } do @@ -16,23 +16,23 @@ class BuildDetailsEntity < JobEntity end expose :path do |build| - namespace_project_merge_request_path(project.namespace, project, build.merge_request) + project_merge_request_path(project, build.merge_request) end end expose :new_issue_path, if: -> (*) { can?(request.current_user, :create_issue, project) && build.failed? } do |build| - new_namespace_project_issue_path(project.namespace, project, issue: build_failed_issue_options) + new_project_issue_path(project, issue: build_failed_issue_options) end expose :raw_path do |build| - raw_namespace_project_job_path(project.namespace, project, build) + raw_project_job_path(project, build) end private def build_failed_issue_options { title: "Build Failed ##{build.id}", - description: namespace_project_job_path(project.namespace, project, build) } + description: project_job_path(project, build) } end def current_user diff --git a/app/serializers/commit_entity.rb b/app/serializers/commit_entity.rb index 31763955f97..e4e9d8ef90a 100644 --- a/app/serializers/commit_entity.rb +++ b/app/serializers/commit_entity.rb @@ -8,16 +8,10 @@ class CommitEntity < API::Entities::RepoCommit end expose :commit_url do |commit| - namespace_project_commit_url( - request.project.namespace, - request.project, - commit) + project_commit_url(request.project, commit) end expose :commit_path do |commit| - namespace_project_commit_path( - request.project.namespace, - request.project, - commit) + project_commit_path(request.project, commit) end end diff --git a/app/serializers/deployment_entity.rb b/app/serializers/deployment_entity.rb index e493c9162fd..241c689bccd 100644 --- a/app/serializers/deployment_entity.rb +++ b/app/serializers/deployment_entity.rb @@ -11,10 +11,7 @@ class DeploymentEntity < Grape::Entity end expose :ref_path do |deployment| - namespace_project_tree_path( - deployment.project.namespace, - deployment.project, - id: deployment.ref) + project_tree_path(deployment.project, id: deployment.ref) end end diff --git a/app/serializers/environment_entity.rb b/app/serializers/environment_entity.rb index 4e8a3c67b21..dcaccc3007d 100644 --- a/app/serializers/environment_entity.rb +++ b/app/serializers/environment_entity.rb @@ -10,32 +10,20 @@ class EnvironmentEntity < Grape::Entity expose :stop_action? expose :metrics_path, if: -> (environment, _) { environment.has_metrics? } do |environment| - metrics_namespace_project_environment_path( - environment.project.namespace, - environment.project, - environment) + metrics_project_environment_path(environment.project, environment) end expose :environment_path do |environment| - namespace_project_environment_path( - environment.project.namespace, - environment.project, - environment) + project_environment_path(environment.project, environment) end expose :stop_path do |environment| - stop_namespace_project_environment_path( - environment.project.namespace, - environment.project, - environment) + stop_project_environment_path(environment.project, environment) end expose :terminal_path, if: ->(environment, _) { environment.has_terminals? } do |environment| can?(request.current_user, :admin_environment, environment.project) && - terminal_namespace_project_environment_path( - environment.project.namespace, - environment.project, - environment) + terminal_project_environment_path(environment.project, environment) end expose :created_at, :updated_at diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb index 35df95549b7..c189a4992da 100644 --- a/app/serializers/issue_entity.rb +++ b/app/serializers/issue_entity.rb @@ -11,6 +11,6 @@ class IssueEntity < IssuableEntity expose :labels, using: LabelEntity expose :web_url do |issue| - namespace_project_issue_path(issue.project.namespace, issue.project, issue) + project_issue_path(issue.project, issue) end end diff --git a/app/serializers/merge_request_entity.rb b/app/serializers/merge_request_entity.rb index 7bb981041cc..7ec2dbd0efe 100644 --- a/app/serializers/merge_request_entity.rb +++ b/app/serializers/merge_request_entity.rb @@ -99,9 +99,7 @@ class MergeRequestEntity < IssuableEntity expose :new_blob_path do |merge_request| if can?(current_user, :push_code, merge_request.project) - namespace_project_new_blob_path(merge_request.project.namespace, - merge_request.project, - merge_request.source_branch) + project_new_blob_path(merge_request.project, merge_request.source_branch) end end @@ -134,30 +132,19 @@ class MergeRequestEntity < IssuableEntity end expose :email_patches_path do |merge_request| - namespace_project_merge_request_path(merge_request.project.namespace, - merge_request.project, - merge_request, - format: :patch) + project_merge_request_path(merge_request.project, merge_request, format: :patch) end expose :plain_diff_path do |merge_request| - namespace_project_merge_request_path(merge_request.project.namespace, - merge_request.project, - merge_request, - format: :diff) + project_merge_request_path(merge_request.project, merge_request, format: :diff) end expose :status_path do |merge_request| - namespace_project_merge_request_path(merge_request.target_project.namespace, - merge_request.target_project, - merge_request, - format: :json) + project_merge_request_path(merge_request.target_project, merge_request, format: :json) end expose :ci_environments_status_path do |merge_request| - ci_environments_status_namespace_project_merge_request_path(merge_request.project.namespace, - merge_request.project, - merge_request) + ci_environments_status_project_merge_request_path(merge_request.project, merge_request) end expose :merge_commit_message_with_description do |merge_request| @@ -173,9 +160,7 @@ class MergeRequestEntity < IssuableEntity end expose :commit_change_content_path do |merge_request| - commit_change_content_namespace_project_merge_request_path(merge_request.project.namespace, - merge_request.project, - merge_request) + commit_change_content_project_merge_request_path(merge_request.project, merge_request) end private diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb index 6d1fd9d459f..c4f000b0ca3 100644 --- a/app/serializers/pipeline_entity.rb +++ b/app/serializers/pipeline_entity.rb @@ -10,10 +10,7 @@ class PipelineEntity < Grape::Entity expose :created_at, :updated_at expose :path do |pipeline| - namespace_project_pipeline_path( - pipeline.project.namespace, - pipeline.project, - pipeline) + project_pipeline_path(pipeline.project, pipeline) end expose :flags do @@ -48,15 +45,11 @@ class PipelineEntity < Grape::Entity expose :commit, using: CommitEntity expose :retry_path, if: -> (*) { can_retry? } do |pipeline| - retry_namespace_project_pipeline_path(pipeline.project.namespace, - pipeline.project, - pipeline.id) + retry_project_pipeline_path(pipeline.project, pipeline) end expose :cancel_path, if: -> (*) { can_cancel? } do |pipeline| - cancel_namespace_project_pipeline_path(pipeline.project.namespace, - pipeline.project, - pipeline.id) + cancel_project_pipeline_path(pipeline.project, pipeline) end expose :yaml_errors, if: -> (pipeline, _) { pipeline.has_yaml_errors? } diff --git a/app/serializers/project_entity.rb b/app/serializers/project_entity.rb index a471a7e6a88..dc283ba3e7a 100644 --- a/app/serializers/project_entity.rb +++ b/app/serializers/project_entity.rb @@ -5,7 +5,7 @@ class ProjectEntity < Grape::Entity expose :name expose :full_path do |project| - namespace_project_path(project.namespace, project) + project_path(project) end expose :full_name do |project| diff --git a/app/serializers/runner_entity.rb b/app/serializers/runner_entity.rb index ed7dacc2dbd..e9999a36d8a 100644 --- a/app/serializers/runner_entity.rb +++ b/app/serializers/runner_entity.rb @@ -5,7 +5,7 @@ class RunnerEntity < Grape::Entity expose :edit_path, if: -> (*) { can?(request.current_user, :admin_build, project) && runner.specific? } do |runner| - edit_namespace_project_runner_path(project.namespace, project, runner) + edit_project_runner_path(project, runner) end private diff --git a/app/serializers/stage_entity.rb b/app/serializers/stage_entity.rb index cee0089056f..4523b15152e 100644 --- a/app/serializers/stage_entity.rb +++ b/app/serializers/stage_entity.rb @@ -14,16 +14,14 @@ class StageEntity < Grape::Entity expose :detailed_status, as: :status, with: StatusEntity expose :path do |stage| - namespace_project_pipeline_path( - stage.pipeline.project.namespace, + project_pipeline_path( stage.pipeline.project, stage.pipeline, anchor: stage.name) end expose :dropdown_path do |stage| - stage_namespace_project_pipeline_path( - stage.pipeline.project.namespace, + stage_project_pipeline_path( stage.pipeline.project, stage.pipeline, stage: stage.name, |