summaryrefslogtreecommitdiff
path: root/lib/api/entities
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 18:09:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 18:09:44 +0000
commit2c156e3c7bbade01c36eee18327f1ced6eebea79 (patch)
tree115fa8dbf6bc05037378b380311d31acb805f54c /lib/api/entities
parent8e129497b2565b8c595ef4f806d9a9595ca654e5 (diff)
downloadgitlab-ce-2c156e3c7bbade01c36eee18327f1ced6eebea79.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/entities')
-rw-r--r--lib/api/entities/discussion.rb2
-rw-r--r--lib/api/entities/note_with_gitlab_employee_badge.rb10
-rw-r--r--lib/api/entities/user_with_gitlab_employee_badge.rb9
3 files changed, 20 insertions, 1 deletions
diff --git a/lib/api/entities/discussion.rb b/lib/api/entities/discussion.rb
index dd1dd40da23..0740de97897 100644
--- a/lib/api/entities/discussion.rb
+++ b/lib/api/entities/discussion.rb
@@ -5,7 +5,7 @@ module API
class Discussion < Grape::Entity
expose :id
expose :individual_note?, as: :individual_note
- expose :notes, using: Entities::Note
+ expose :notes, using: Entities::NoteWithGitlabEmployeeBadge
end
end
end
diff --git a/lib/api/entities/note_with_gitlab_employee_badge.rb b/lib/api/entities/note_with_gitlab_employee_badge.rb
new file mode 100644
index 00000000000..2ea300ffeb6
--- /dev/null
+++ b/lib/api/entities/note_with_gitlab_employee_badge.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+module API
+ module Entities
+ class NoteWithGitlabEmployeeBadge < Note
+ expose :author, using: Entities::UserWithGitlabEmployeeBadge
+ expose :resolved_by, using: Entities::UserWithGitlabEmployeeBadge, if: ->(note, options) { note.resolvable? }
+ end
+ end
+end
diff --git a/lib/api/entities/user_with_gitlab_employee_badge.rb b/lib/api/entities/user_with_gitlab_employee_badge.rb
new file mode 100644
index 00000000000..36b9f633132
--- /dev/null
+++ b/lib/api/entities/user_with_gitlab_employee_badge.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module API
+ module Entities
+ class UserWithGitlabEmployeeBadge < UserBasic
+ expose :gitlab_employee?, as: :is_gitlab_employee, if: ->(user, options) { ::Feature.enabled?(:gitlab_employee_badge) && user.gitlab_employee? }
+ end
+ end
+end