summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorBaldinoF <baldinof@gmail.com>2016-04-17 18:17:27 +0200
committerBaldinoF <baldinof@gmail.com>2016-04-17 18:17:27 +0200
commitb04140a1e497c75a721bc4e5458907bf35a0a8b9 (patch)
tree8005646150e1c6979061e56a30f661b18ec331c7 /lib/api/entities.rb
parent3918fce5bd073e18addb7d1d4aaf3c81ce8150b0 (diff)
parent5048064dc5e7ca30f65209c7ccd9fb90f9ac49db (diff)
downloadgitlab-ce-b04140a1e497c75a721bc4e5458907bf35a0a8b9.tar.gz
Merge branch 'master' into number_sign_for_external_issue_ref
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb35
1 files changed, 24 insertions, 11 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 197e826e5bc..60b9f5e0ece 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -8,14 +8,14 @@ module API
expose :id, :state, :avatar_url
expose :web_url do |user, options|
- Gitlab::Application.routes.url_helpers.user_url(user)
+ Gitlab::Routing.url_helpers.user_url(user)
end
end
class User < UserBasic
expose :created_at
expose :is_admin?, as: :is_admin
- expose :bio, :skype, :linkedin, :twitter, :website_url
+ expose :bio, :location, :skype, :linkedin, :twitter, :website_url
end
class Identity < Grape::Entity
@@ -89,7 +89,7 @@ module API
expose :avatar_url
expose :web_url do |group, options|
- Gitlab::Application.routes.url_helpers.group_url(group)
+ Gitlab::Routing.url_helpers.group_url(group)
end
end
@@ -170,6 +170,10 @@ module API
expose :label_names, as: :labels
expose :milestone, using: Entities::Milestone
expose :assignee, :author, using: Entities::UserBasic
+
+ expose :subscribed do |issue, options|
+ issue.subscribed?(options[:current_user])
+ end
end
class MergeRequest < ProjectEntity
@@ -183,6 +187,10 @@ module API
expose :milestone, using: Entities::Milestone
expose :merge_when_build_succeeds
expose :merge_status
+
+ expose :subscribed do |merge_request, options|
+ merge_request.subscribed?(options[:current_user])
+ end
end
class MergeRequestChanges < MergeRequest
@@ -204,7 +212,7 @@ module API
expose :note, as: :body
expose :attachment_identifier, as: :attachment
expose :author, using: Entities::UserBasic
- expose :created_at
+ expose :created_at, :updated_at
expose :system?, as: :system
expose :noteable_id, :noteable_type
# upvote? and downvote? are deprecated, always return false
@@ -255,14 +263,19 @@ module API
expose :id, :path, :kind
end
- class ProjectAccess < Grape::Entity
+ class Member < Grape::Entity
expose :access_level
- expose :notification_level
+ expose :notification_level do |member, options|
+ if member.notification_setting
+ NotificationSetting.levels[member.notification_setting.level]
+ end
+ end
end
- class GroupAccess < Grape::Entity
- expose :access_level
- expose :notification_level
+ class ProjectAccess < Member
+ end
+
+ class GroupAccess < Member
end
class ProjectService < Grape::Entity
@@ -292,7 +305,8 @@ module API
end
class Label < Grape::Entity
- expose :name, :color
+ expose :name, :color, :description
+ expose :open_issues_count, :closed_issues_count, :open_merge_requests_count
end
class Compare < Grape::Entity
@@ -334,7 +348,6 @@ module API
expose :updated_at
expose :home_page_url
expose :default_branch_protection
- expose :twitter_sharing_enabled
expose :restricted_visibility_levels
expose :max_attachment_size
expose :session_expire_delay