diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-11-09 13:19:48 +1300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-11-09 13:19:48 +1300 |
commit | 03dba01273d548ab8c0dd82408400a834fb4e10f (patch) | |
tree | f5d5da30035fbfa84922d11b3328ed3866382914 /app/serializers | |
parent | ab61bee378ed45ff01d74742b54149533811a204 (diff) | |
download | gitlab-ce-03dba01273d548ab8c0dd82408400a834fb4e10f.tar.gz |
Revert "Extract code into IssueBoardEntity"revert_issue_board_entity
This reverts commit 8c126525faba40032244328187ba73a53b6eaf4c.
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/README.md | 4 | ||||
-rw-r--r-- | app/serializers/issue_board_entity.rb | 52 | ||||
-rw-r--r-- | app/serializers/issue_serializer.rb | 6 | ||||
-rw-r--r-- | app/serializers/label_entity.rb | 4 |
4 files changed, 4 insertions, 62 deletions
diff --git a/app/serializers/README.md b/app/serializers/README.md index bb94745b0b5..0337f88db5f 100644 --- a/app/serializers/README.md +++ b/app/serializers/README.md @@ -180,7 +180,7 @@ def index render json: MyResourceSerializer .new(current_user: @current_user) .represent_details(@project.resources) - end + nd end ``` @@ -196,7 +196,7 @@ def index .represent_details(@project.resources), count: @project.resources.count } - end + nd end ``` diff --git a/app/serializers/issue_board_entity.rb b/app/serializers/issue_board_entity.rb deleted file mode 100644 index 4e3d03b236b..00000000000 --- a/app/serializers/issue_board_entity.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -class IssueBoardEntity < Grape::Entity - include RequestAwareEntity - - expose :id - expose :iid - expose :title - - expose :confidential - expose :due_date - expose :project_id - expose :relative_position - expose :weight, if: -> (*) { respond_to?(:weight) } - expose :time_estimate - - expose :project do |issue| - API::Entities::Project.represent issue.project, only: [:id, :path] - end - - expose :milestone, expose_nil: false do |issue| - API::Entities::Project.represent issue.milestone, only: [:id, :title] - end - - expose :assignees do |issue| - API::Entities::UserBasic.represent issue.assignees, only: [:id, :name, :username, :avatar_url] - end - - expose :labels do |issue| - LabelEntity.represent issue.labels, project: issue.project, only: [:id, :title, :description, :color, :priority, :text_color] - end - - expose :reference_path, if: -> (issue) { issue.project } do |issue, options| - options[:include_full_project_path] ? issue.to_reference(full: true) : issue.to_reference - end - - expose :real_path, if: -> (issue) { issue.project } do |issue| - project_issue_path(issue.project, issue) - end - - expose :issue_sidebar_endpoint, if: -> (issue) { issue.project } do |issue| - project_issue_path(issue.project, issue, format: :json, serializer: 'sidebar') - end - - expose :toggle_subscription_endpoint, if: -> (issue) { issue.project } do |issue| - toggle_subscription_project_issue_path(issue.project, issue) - end - - expose :assignable_labels_endpoint, if: -> (issue) { issue.project } do |issue| - project_labels_path(issue.project, format: :json, include_ancestor_groups: true) - end -end diff --git a/app/serializers/issue_serializer.rb b/app/serializers/issue_serializer.rb index d66f0a5acb7..37cf5e28396 100644 --- a/app/serializers/issue_serializer.rb +++ b/app/serializers/issue_serializer.rb @@ -4,17 +4,15 @@ class IssueSerializer < BaseSerializer # This overrided method takes care of which entity should be used # to serialize the `issue` based on `basic` key in `opts` param. # Hence, `entity` doesn't need to be declared on the class scope. - def represent(issue, opts = {}) + def represent(merge_request, opts = {}) entity = case opts[:serializer] when 'sidebar' IssueSidebarEntity - when 'board' - IssueBoardEntity else IssueEntity end - super(issue, opts, entity) + super(merge_request, opts, entity) end end diff --git a/app/serializers/label_entity.rb b/app/serializers/label_entity.rb index 5082245dda9..98743d62b50 100644 --- a/app/serializers/label_entity.rb +++ b/app/serializers/label_entity.rb @@ -12,8 +12,4 @@ class LabelEntity < Grape::Entity expose :text_color expose :created_at expose :updated_at - - expose :priority, if: -> (*) { options.key?(:project) } do |label| - label.priority(options[:project]) - end end |