diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 09:40:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 09:40:42 +0000 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /app/serializers | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) | |
download | gitlab-ce-ee664acb356f8123f4f6b00b73c1e1cf0866c7fb.tar.gz |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/board_serializer.rb | 5 | ||||
-rw-r--r-- | app/serializers/board_simple_entity.rb | 8 | ||||
-rw-r--r-- | app/serializers/current_board_entity.rb | 10 | ||||
-rw-r--r-- | app/serializers/current_board_serializer.rb | 5 | ||||
-rw-r--r-- | app/serializers/group_access_token_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/import/github_org_entity.rb | 8 | ||||
-rw-r--r-- | app/serializers/import/github_org_serializer.rb | 7 | ||||
-rw-r--r-- | app/serializers/issue_entity.rb | 4 | ||||
-rw-r--r-- | app/serializers/merge_request_noteable_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/merge_request_user_entity.rb | 4 | ||||
-rw-r--r-- | app/serializers/project_access_token_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/user_serializer.rb | 2 |
12 files changed, 27 insertions, 32 deletions
diff --git a/app/serializers/board_serializer.rb b/app/serializers/board_serializer.rb deleted file mode 100644 index 70a4c9ae282..00000000000 --- a/app/serializers/board_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -class BoardSerializer < BaseSerializer - entity BoardSimpleEntity -end diff --git a/app/serializers/board_simple_entity.rb b/app/serializers/board_simple_entity.rb deleted file mode 100644 index ab625490966..00000000000 --- a/app/serializers/board_simple_entity.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -class BoardSimpleEntity < Grape::Entity - expose :id - expose :name -end - -BoardSimpleEntity.prepend_mod_with('BoardSimpleEntity') diff --git a/app/serializers/current_board_entity.rb b/app/serializers/current_board_entity.rb deleted file mode 100644 index 530f7f5dea3..00000000000 --- a/app/serializers/current_board_entity.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class CurrentBoardEntity < Grape::Entity - expose :id - expose :name - expose :hide_backlog_list - expose :hide_closed_list -end - -CurrentBoardEntity.prepend_mod_with('CurrentBoardEntity') diff --git a/app/serializers/current_board_serializer.rb b/app/serializers/current_board_serializer.rb deleted file mode 100644 index c58c77194f2..00000000000 --- a/app/serializers/current_board_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -class CurrentBoardSerializer < BaseSerializer - entity CurrentBoardEntity -end diff --git a/app/serializers/group_access_token_entity.rb b/app/serializers/group_access_token_entity.rb index ab1fbb8ab46..83e8284e4e2 100644 --- a/app/serializers/group_access_token_entity.rb +++ b/app/serializers/group_access_token_entity.rb @@ -11,7 +11,7 @@ class GroupAccessTokenEntity < AccessTokenEntityBase revoke_group_settings_access_token_path( id: token, - group_id: group.path) + group_id: group.full_path) end expose :role do |token, options| diff --git a/app/serializers/import/github_org_entity.rb b/app/serializers/import/github_org_entity.rb new file mode 100644 index 00000000000..a250a9b60f5 --- /dev/null +++ b/app/serializers/import/github_org_entity.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Import + class GithubOrgEntity < Grape::Entity + expose :login, as: :name + expose :description + end +end diff --git a/app/serializers/import/github_org_serializer.rb b/app/serializers/import/github_org_serializer.rb new file mode 100644 index 00000000000..69a598e4b24 --- /dev/null +++ b/app/serializers/import/github_org_serializer.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Import + class GithubOrgSerializer < BaseSerializer + entity Import::GithubOrgEntity + end +end diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb index 7ff75927fcd..3d94d2e2e9d 100644 --- a/app/serializers/issue_entity.rb +++ b/app/serializers/issue_entity.rb @@ -43,6 +43,10 @@ class IssueEntity < IssuableEntity can?(request.current_user, :create_note, issue) end + expose :can_create_confidential_note do |issue| + can?(request.current_user, :mark_note_as_confidential, issue) + end + expose :can_update do |issue| can?(request.current_user, :update_issue, issue) end diff --git a/app/serializers/merge_request_noteable_entity.rb b/app/serializers/merge_request_noteable_entity.rb index 29bd26c3a15..07d7d19d1f3 100644 --- a/app/serializers/merge_request_noteable_entity.rb +++ b/app/serializers/merge_request_noteable_entity.rb @@ -51,7 +51,7 @@ class MergeRequestNoteableEntity < IssuableEntity end expose :can_approve do |merge_request| - merge_request.can_be_approved_by?(current_user) + merge_request.eligible_for_approval_by?(current_user) end end diff --git a/app/serializers/merge_request_user_entity.rb b/app/serializers/merge_request_user_entity.rb index 36825d14062..caf2e4c89b6 100644 --- a/app/serializers/merge_request_user_entity.rb +++ b/app/serializers/merge_request_user_entity.rb @@ -25,6 +25,10 @@ class MergeRequestUserEntity < ::API::Entities::UserBasic # makes one query per merge request, whereas #approved_by? makes one per user options[:merge_request].approvals.any? { |app| app.user_id == user.id } end + + expose :suggested, if: satisfies(:present?) do |user, options| + options[:suggested] + end end MergeRequestUserEntity.prepend_mod_with('MergeRequestUserEntity') diff --git a/app/serializers/project_access_token_entity.rb b/app/serializers/project_access_token_entity.rb index 52bb7b05d4e..548fb24173a 100644 --- a/app/serializers/project_access_token_entity.rb +++ b/app/serializers/project_access_token_entity.rb @@ -11,7 +11,7 @@ class ProjectAccessTokenEntity < AccessTokenEntityBase revoke_namespace_project_settings_access_token_path( id: token, - namespace_id: project.namespace.path, + namespace_id: project.namespace.full_path, project_id: project.path) end diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index 5e7dab31e8a..5082b84978a 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -8,7 +8,7 @@ class UserSerializer < BaseSerializer merge_request = opts[:project].merge_requests.find_by_iid!(params[:merge_request_iid]) preload_max_member_access(merge_request.project, Array(resource)) - super(resource, opts.merge(merge_request: merge_request), MergeRequestUserEntity) + super(resource, opts.merge(merge_request: merge_request, suggested: params[:suggested]), MergeRequestUserEntity) else super end |