Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 22:00:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-18 22:00:14 +0300
commit05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch)
tree11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /app/serializers
parentec73467c23693d0db63a797d10194da9e72a74af (diff)
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/ci/downloadable_artifact_entity.rb2
-rw-r--r--app/serializers/ci/pipeline_entity.rb2
-rw-r--r--app/serializers/diffs_entity.rb2
-rw-r--r--app/serializers/diffs_metadata_entity.rb2
-rw-r--r--app/serializers/group_link/group_group_link_entity.rb4
-rw-r--r--app/serializers/group_link/group_link_entity.rb2
-rw-r--r--app/serializers/group_link/project_group_link_entity.rb4
-rw-r--r--app/serializers/issue_entity.rb2
-rw-r--r--app/serializers/merge_requests/pipeline_entity.rb4
-rw-r--r--app/serializers/paginated_diff_entity.rb2
-rw-r--r--app/serializers/remote_mirror_entity.rb2
11 files changed, 19 insertions, 9 deletions
diff --git a/app/serializers/ci/downloadable_artifact_entity.rb b/app/serializers/ci/downloadable_artifact_entity.rb
index 1f3885f0715..2e8aafcee43 100644
--- a/app/serializers/ci/downloadable_artifact_entity.rb
+++ b/app/serializers/ci/downloadable_artifact_entity.rb
@@ -8,7 +8,7 @@ module Ci
artifacts = pipeline.downloadable_artifacts
if Feature.enabled?(:non_public_artifacts)
- artifacts = artifacts.select { |artifact| can?(request.current_user, :read_job_artifacts, artifact.job) }
+ artifacts = artifacts.select { |artifact| can?(request.current_user, :read_job_artifacts, artifact) }
end
BuildArtifactEntity.represent(artifacts, options.merge(project: pipeline.project))
diff --git a/app/serializers/ci/pipeline_entity.rb b/app/serializers/ci/pipeline_entity.rb
index 143017c5159..5e6ae0986df 100644
--- a/app/serializers/ci/pipeline_entity.rb
+++ b/app/serializers/ci/pipeline_entity.rb
@@ -10,7 +10,7 @@ class Ci::PipelineEntity < Grape::Entity
expose :iid
expose :user, using: UserEntity
expose :active?, as: :active
- expose :name, if: -> (pipeline, _) { Feature.enabled?(:pipeline_name, pipeline.project) }
+ expose :name
# Coverage isn't always necessary (e.g. when displaying project pipelines in
# the UI). Instead of creating an entirely different entity we just allow the
diff --git a/app/serializers/diffs_entity.rb b/app/serializers/diffs_entity.rb
index 759d1e0f10a..5b30c0bb58c 100644
--- a/app/serializers/diffs_entity.rb
+++ b/app/serializers/diffs_entity.rb
@@ -74,7 +74,7 @@ class DiffsEntity < Grape::Entity
options.merge(
submodule_links: submodule_links,
code_navigation_path: code_navigation_path(diffs),
- conflicts: (conflicts(allow_tree_conflicts: true) if options[:merge_conflicts_in_diff])
+ conflicts: conflicts(allow_tree_conflicts: true)
)
)
end
diff --git a/app/serializers/diffs_metadata_entity.rb b/app/serializers/diffs_metadata_entity.rb
index ace5105dda5..e55f31a8376 100644
--- a/app/serializers/diffs_metadata_entity.rb
+++ b/app/serializers/diffs_metadata_entity.rb
@@ -6,7 +6,7 @@ class DiffsMetadataEntity < DiffsEntity
DiffFileMetadataEntity.represent(
diffs.raw_diff_files(sorted: true),
options.merge(
- conflicts: (conflicts(allow_tree_conflicts: true) if options[:merge_conflicts_in_diff])
+ conflicts: conflicts(allow_tree_conflicts: true)
)
)
end
diff --git a/app/serializers/group_link/group_group_link_entity.rb b/app/serializers/group_link/group_group_link_entity.rb
index 563a75ccdaa..d5d7eea74ea 100644
--- a/app/serializers/group_link/group_group_link_entity.rb
+++ b/app/serializers/group_link/group_group_link_entity.rb
@@ -10,6 +10,10 @@ module GroupLink
private
+ def can_admin_group_link?(group_link, options)
+ can?(current_user, admin_permission_name, group_link.shared_from)
+ end
+
def admin_permission_name
:admin_group_member
end
diff --git a/app/serializers/group_link/group_link_entity.rb b/app/serializers/group_link/group_link_entity.rb
index 73c9931fc70..4cc7e9f3c8c 100644
--- a/app/serializers/group_link/group_link_entity.rb
+++ b/app/serializers/group_link/group_link_entity.rb
@@ -36,7 +36,7 @@ module GroupLink
end
expose :can_remove do |group_link, options|
- can_admin_shared_from?(group_link, options)
+ direct_member?(group_link, options) && can_admin_group_link?(group_link, options)
end
expose :is_direct_member do |group_link, options|
diff --git a/app/serializers/group_link/project_group_link_entity.rb b/app/serializers/group_link/project_group_link_entity.rb
index c667bcd5bf4..d246bff1c58 100644
--- a/app/serializers/group_link/project_group_link_entity.rb
+++ b/app/serializers/group_link/project_group_link_entity.rb
@@ -10,6 +10,10 @@ module GroupLink
private
+ def can_admin_group_link?(group_link, options)
+ can?(current_user, :admin_project_group_link, group_link)
+ end
+
def admin_permission_name
:admin_project_member
end
diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb
index 397f333008c..a38f345f617 100644
--- a/app/serializers/issue_entity.rb
+++ b/app/serializers/issue_entity.rb
@@ -48,7 +48,7 @@ class IssueEntity < IssuableEntity
end
expose :can_create_confidential_note do |issue|
- can?(request.current_user, :mark_note_as_confidential, issue)
+ can?(request.current_user, :mark_note_as_internal, issue)
end
expose :can_update do |issue|
diff --git a/app/serializers/merge_requests/pipeline_entity.rb b/app/serializers/merge_requests/pipeline_entity.rb
index 76e75a8ca6d..cf050b32d21 100644
--- a/app/serializers/merge_requests/pipeline_entity.rb
+++ b/app/serializers/merge_requests/pipeline_entity.rb
@@ -5,7 +5,7 @@ class MergeRequests::PipelineEntity < Grape::Entity
expose :id
expose :active?, as: :active
- expose :name, if: -> (pipeline, _) { Feature.enabled?(:pipeline_name, pipeline.project) }
+ expose :name
expose :path do |pipeline|
project_pipeline_path(pipeline.project, pipeline)
@@ -30,7 +30,7 @@ class MergeRequests::PipelineEntity < Grape::Entity
rel = pipeline.downloadable_artifacts
if Feature.enabled?(:non_public_artifacts, type: :development)
- rel = rel.select { |artifact| can?(request.current_user, :read_job_artifacts, artifact.job) }
+ rel = rel.select { |artifact| can?(request.current_user, :read_job_artifacts, artifact) }
end
BuildArtifactEntity.represent(rel, options.merge(project: pipeline.project))
diff --git a/app/serializers/paginated_diff_entity.rb b/app/serializers/paginated_diff_entity.rb
index b79a0937659..67f4014990c 100644
--- a/app/serializers/paginated_diff_entity.rb
+++ b/app/serializers/paginated_diff_entity.rb
@@ -17,7 +17,7 @@ class PaginatedDiffEntity < Grape::Entity
options.merge(
submodule_links: submodule_links,
code_navigation_path: code_navigation_path(diffs),
- conflicts: (conflicts(allow_tree_conflicts: true) if options[:merge_conflicts_in_diff])
+ conflicts: conflicts(allow_tree_conflicts: true)
)
)
end
diff --git a/app/serializers/remote_mirror_entity.rb b/app/serializers/remote_mirror_entity.rb
index 440e4274668..7eddb3fef4a 100644
--- a/app/serializers/remote_mirror_entity.rb
+++ b/app/serializers/remote_mirror_entity.rb
@@ -13,3 +13,5 @@ class RemoteMirrorEntity < Grape::Entity
remote_mirror.ssh_known_hosts_fingerprints.as_json
end
end
+
+RemoteMirrorEntity.prepend_mod