summaryrefslogtreecommitdiff
path: root/lib/api/entities
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 09:16:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 09:16:11 +0000
commitedaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch)
tree11f143effbfeba52329fb7afbd05e6e2a3790241 /lib/api/entities
parentd8a5691316400a0f7ec4f83832698f1988eb27c1 (diff)
downloadgitlab-ce-edaa33dee2ff2f7ea3fac488d41558eb5f86d68c.tar.gz
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'lib/api/entities')
-rw-r--r--lib/api/entities/group_detail.rb2
-rw-r--r--lib/api/entities/issue_basic.rb2
-rw-r--r--lib/api/entities/merge_request_basic.rb4
-rw-r--r--lib/api/entities/project.rb3
-rw-r--r--lib/api/entities/project_with_access.rb2
-rw-r--r--lib/api/entities/resource_access_token.rb2
6 files changed, 11 insertions, 4 deletions
diff --git a/lib/api/entities/group_detail.rb b/lib/api/entities/group_detail.rb
index 5eaccbc7154..e6872709432 100644
--- a/lib/api/entities/group_detail.rb
+++ b/lib/api/entities/group_detail.rb
@@ -4,7 +4,7 @@ module API
module Entities
class GroupDetail < Group
expose :shared_with_groups do |group, options|
- SharedGroupWithGroup.represent(group.shared_with_group_links.public_or_visible_to_user(group, options[:current_user]))
+ SharedGroupWithGroup.represent(group.shared_with_group_links_visible_to_user(options[:current_user]))
end
expose :runners_token, if: lambda { |group, options| options[:user_can_admin_group] }
expose :prevent_sharing_groups_outside_hierarchy, if: ->(group) { group.root? }
diff --git a/lib/api/entities/issue_basic.rb b/lib/api/entities/issue_basic.rb
index 6125dc05a6e..20f66c026e6 100644
--- a/lib/api/entities/issue_basic.rb
+++ b/lib/api/entities/issue_basic.rb
@@ -23,7 +23,7 @@ module API
expose :issue_type,
as: :type,
format_with: :upcase,
- documentation: { type: "String", desc: "One of #{::WorkItem::Type.allowed_types_for_issues.map(&:upcase)}" }
+ documentation: { type: "String", desc: "One of #{::WorkItems::Type.allowed_types_for_issues.map(&:upcase)}" }
expose :assignee, using: ::API::Entities::UserBasic do |issue|
issue.assignees.first
diff --git a/lib/api/entities/merge_request_basic.rb b/lib/api/entities/merge_request_basic.rb
index d5cf2f653db..55d58166590 100644
--- a/lib/api/entities/merge_request_basic.rb
+++ b/lib/api/entities/merge_request_basic.rb
@@ -3,9 +3,13 @@
module API
module Entities
class MergeRequestBasic < IssuableEntity
+ # Deprecated in favour of merge_user
expose :merged_by, using: Entities::UserBasic do |merge_request, _options|
merge_request.metrics&.merged_by
end
+ expose :merge_user, using: Entities::UserBasic do |merge_request|
+ merge_request.metrics&.merged_by || merge_request.merge_user
+ end
expose :merged_at do |merge_request, _options|
merge_request.metrics&.merged_at
end
diff --git a/lib/api/entities/project.rb b/lib/api/entities/project.rb
index 1b9299ed17e..74097dc2883 100644
--- a/lib/api/entities/project.rb
+++ b/lib/api/entities/project.rb
@@ -82,6 +82,8 @@ module API
expose :forked_from_project, using: Entities::BasicProjectDetails, if: ->(project, options) do
project.forked? && Ability.allowed?(options[:current_user], :read_project, project.forked_from_project)
end
+ expose :mr_default_target_self, if: -> (project) { project.forked? }
+
expose :import_status
expose :import_error, if: lambda { |_project, options| options[:user_can_admin_project] } do |project|
@@ -130,6 +132,7 @@ module API
Ability.allowed?(options[:current_user], :change_repository_storage, project)
}
expose :keep_latest_artifacts_available?, as: :keep_latest_artifact
+ expose :runner_token_expiration_interval
# rubocop: disable CodeReuse/ActiveRecord
def self.preload_resource(project)
diff --git a/lib/api/entities/project_with_access.rb b/lib/api/entities/project_with_access.rb
index ac89cb52e43..b541ccbadcf 100644
--- a/lib/api/entities/project_with_access.rb
+++ b/lib/api/entities/project_with_access.rb
@@ -8,7 +8,7 @@ module API
if options[:project_members]
options[:project_members].find { |member| member.source_id == project.id }
else
- project.project_member(options[:current_user])
+ project.member(options[:current_user])
end
end
diff --git a/lib/api/entities/resource_access_token.rb b/lib/api/entities/resource_access_token.rb
index a1c7b28af45..569fd16f488 100644
--- a/lib/api/entities/resource_access_token.rb
+++ b/lib/api/entities/resource_access_token.rb
@@ -4,7 +4,7 @@ module API
module Entities
class ResourceAccessToken < Entities::PersonalAccessToken
expose :access_level do |token, options|
- options[:project].project_member(token.user).access_level
+ options[:resource].member(token.user).access_level
end
end
end