summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2017-12-07 19:56:59 -0200
committerOswaldo Ferreira <oswaldo@gitlab.com>2017-12-15 15:31:16 -0200
commitcba40a1f551e4c1b46bfa49a709f59feb59782bd (patch)
tree85dd5352db35ba26b7dc060e3d514f43799152f1 /app/serializers
parent73a79f7efbd8dec42b4a344faa3df5bf1c57a315 (diff)
downloadgitlab-ce-cba40a1f551e4c1b46bfa49a709f59feb59782bd.tar.gz
Stop sending milestone and labels data over the wire for MR widgetosw-isolate-mr-widget-exposed-attributes
requests
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/issuable_entity.rb8
-rw-r--r--app/serializers/issuable_sidebar_entity.rb6
-rw-r--r--app/serializers/issue_entity.rb8
-rw-r--r--app/serializers/merge_request_serializer.rb6
-rw-r--r--app/serializers/merge_request_widget_entity.rb (renamed from app/serializers/merge_request_entity.rb)5
5 files changed, 13 insertions, 20 deletions
diff --git a/app/serializers/issuable_entity.rb b/app/serializers/issuable_entity.rb
index 3b5a4fd4f79..6f31fbd6b7c 100644
--- a/app/serializers/issuable_entity.rb
+++ b/app/serializers/issuable_entity.rb
@@ -3,14 +3,6 @@ class IssuableEntity < Grape::Entity
expose :id
expose :iid
- expose :author_id
expose :description
- expose :lock_version
- expose :milestone_id
expose :title
- expose :updated_by_id
- expose :created_at
- expose :updated_at
- expose :milestone, using: API::Entities::Milestone
- expose :labels, using: LabelEntity
end
diff --git a/app/serializers/issuable_sidebar_entity.rb b/app/serializers/issuable_sidebar_entity.rb
index ff23d8bf0c7..29138c803df 100644
--- a/app/serializers/issuable_sidebar_entity.rb
+++ b/app/serializers/issuable_sidebar_entity.rb
@@ -1,4 +1,5 @@
class IssuableSidebarEntity < Grape::Entity
+ include TimeTrackableEntity
include RequestAwareEntity
expose :participants, using: ::API::Entities::UserBasic do |issuable|
@@ -8,9 +9,4 @@ class IssuableSidebarEntity < Grape::Entity
expose :subscribed do |issuable|
issuable.subscribed?(request.current_user, issuable.project)
end
-
- expose :time_estimate
- expose :total_time_spent
- expose :human_time_estimate
- expose :human_total_time_spent
end
diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb
index 9d52b8d9752..0bdd4d7a272 100644
--- a/app/serializers/issue_entity.rb
+++ b/app/serializers/issue_entity.rb
@@ -2,7 +2,15 @@ class IssueEntity < IssuableEntity
include TimeTrackableEntity
expose :state
+ expose :milestone_id
+ expose :updated_by_id
+ expose :created_at
+ expose :updated_at
expose :deleted_at
+ expose :milestone, using: API::Entities::Milestone
+ expose :labels, using: LabelEntity
+ expose :lock_version
+ expose :author_id
expose :confidential
expose :discussion_locked
expose :assignees, using: API::Entities::UserBasic
diff --git a/app/serializers/merge_request_serializer.rb b/app/serializers/merge_request_serializer.rb
index e9d98d8baca..52eb30d688a 100644
--- a/app/serializers/merge_request_serializer.rb
+++ b/app/serializers/merge_request_serializer.rb
@@ -1,14 +1,14 @@
class MergeRequestSerializer < BaseSerializer
# This overrided method takes care of which entity should be used
- # to serialize the `merge_request` based on `basic` key in `opts` param.
+ # to serialize the `merge_request` based on `serializer` key in `opts` param.
# Hence, `entity` doesn't need to be declared on the class scope.
def represent(merge_request, opts = {})
entity =
case opts[:serializer]
when 'basic', 'sidebar'
MergeRequestBasicEntity
- else
- MergeRequestEntity
+ when 'widget'
+ MergeRequestWidgetEntity
end
super(merge_request, opts, entity)
diff --git a/app/serializers/merge_request_entity.rb b/app/serializers/merge_request_widget_entity.rb
index eece9445dca..f8e59b2ffd7 100644
--- a/app/serializers/merge_request_entity.rb
+++ b/app/serializers/merge_request_widget_entity.rb
@@ -1,8 +1,5 @@
-class MergeRequestEntity < IssuableEntity
- include TimeTrackableEntity
-
+class MergeRequestWidgetEntity < IssuableEntity
expose :state
- expose :deleted_at
expose :in_progress_merge_commit_sha
expose :merge_commit_sha
expose :merge_error