diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2017-02-20 15:35:05 +0100 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2017-02-22 13:07:49 +0100 |
commit | 0b402e11e355dc8d834fbc139f4bca810a9f766e (patch) | |
tree | b03e45e942533bb1ae1811e59d42af88ca44fe7e /lib/api/v3/entities.rb | |
parent | 87411889b9c8a778bebafeaa381e1d736af7329a (diff) | |
download | gitlab-ce-0b402e11e355dc8d834fbc139f4bca810a9f766e.tar.gz |
Remove deprecated `upvotes` and `downvotes` from the notes API
Diffstat (limited to 'lib/api/v3/entities.rb')
-rw-r--r-- | lib/api/v3/entities.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/api/v3/entities.rb b/lib/api/v3/entities.rb index 3cc0dc968a8..11d0e6dbf71 100644 --- a/lib/api/v3/entities.rb +++ b/lib/api/v3/entities.rb @@ -11,6 +11,40 @@ module API Gitlab::UrlBuilder.build(snippet) end end + + class Note < Grape::Entity + expose :id + expose :note, as: :body + expose :attachment_identifier, as: :attachment + expose :author, using: ::API::Entities::UserBasic + expose :created_at, :updated_at + expose :system?, as: :system + expose :noteable_id, :noteable_type + # upvote? and downvote? are deprecated, always return false + expose(:upvote?) { |note| false } + expose(:downvote?) { |note| false } + end + + class Event < Grape::Entity + expose :title, :project_id, :action_name + expose :target_id, :target_type, :author_id + expose :data, :target_title + expose :created_at + expose :note, using: Entities::Note, if: ->(event, options) { event.note? } + expose :author, using: ::API::Entities::UserBasic, if: ->(event, options) { event.author } + + expose :author_username do |event, options| + event.author&.username + end + end + + class AwardEmoji < Grape::Entity + expose :id + expose :name + expose :user, using: ::API::Entities::UserBasic + expose :created_at, :updated_at + expose :awardable_id, :awardable_type + end end end end |