diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-04-04 16:08:34 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-04-04 16:08:34 +0300 |
commit | e540c0d71e00c4ce031b94cf11ec3de905e87da7 (patch) | |
tree | fdd99edfd413a3473fe4a9f72719913decfd9777 /app/serializers | |
parent | 30988aecd9fe8223563d02942666683fb1bd29c0 (diff) |
Fixed test specs
- added suggestions to mock data
- fixed props to be not required
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/issue_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/merge_request_widget_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/suggestion_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/suggestion_serializer.rb | 9 |
4 files changed, 13 insertions, 2 deletions
diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb index c3f7d4651fb..914ad628a99 100644 --- a/app/serializers/issue_entity.rb +++ b/app/serializers/issue_entity.rb @@ -42,6 +42,6 @@ class IssueEntity < IssuableEntity end expose :preview_note_path do |issue| - preview_markdown_path(issue.project, quick_actions_target_type: 'Issue', quick_actions_target_id: issue.iid) + preview_markdown_path(issue.project, target_type: 'Issue', target_id: issue.iid) end end diff --git a/app/serializers/merge_request_widget_entity.rb b/app/serializers/merge_request_widget_entity.rb index d673f8ae896..4831eb32c96 100644 --- a/app/serializers/merge_request_widget_entity.rb +++ b/app/serializers/merge_request_widget_entity.rb @@ -235,7 +235,7 @@ class MergeRequestWidgetEntity < IssuableEntity end expose :preview_note_path do |merge_request| - preview_markdown_path(merge_request.project, quick_actions_target_type: 'MergeRequest', quick_actions_target_id: merge_request.iid) + preview_markdown_path(merge_request.project, target_type: 'MergeRequest', target_id: merge_request.iid) end expose :merge_commit_path do |merge_request| diff --git a/app/serializers/suggestion_entity.rb b/app/serializers/suggestion_entity.rb index 4d0d4da10be..2dd62e19e29 100644 --- a/app/serializers/suggestion_entity.rb +++ b/app/serializers/suggestion_entity.rb @@ -3,6 +3,8 @@ class SuggestionEntity < API::Entities::Suggestion include RequestAwareEntity + unexpose :from_line, :to_line, :from_content, :to_content + expose :diff_lines, using: DiffLineEntity expose :current_user do expose :can_apply do |suggestion| Ability.allowed?(current_user, :apply_suggestion, suggestion) diff --git a/app/serializers/suggestion_serializer.rb b/app/serializers/suggestion_serializer.rb new file mode 100644 index 00000000000..010344f9fcd --- /dev/null +++ b/app/serializers/suggestion_serializer.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class SuggestionSerializer < BaseSerializer + entity SuggestionEntity + + def represent_diff(resource) + represent(resource, { only: [:diff_lines] }) + end +end |