diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 06:08:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 06:08:51 +0300 |
commit | cf127374b5f72c00426acad9f2432064eeb1f1e3 (patch) | |
tree | 710922928ab9888128a6c9f9dbc0edbf6ef2f8af /app/serializers | |
parent | 7303dddd09bf28d28e36666f0cc2775e9fa27872 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/base_discussion_entity.rb | 6 | ||||
-rw-r--r-- | app/serializers/note_entity.rb | 4 | ||||
-rw-r--r-- | app/serializers/project_note_entity.rb | 8 |
3 files changed, 5 insertions, 13 deletions
diff --git a/app/serializers/base_discussion_entity.rb b/app/serializers/base_discussion_entity.rb index d1aef60a09e..0b006078343 100644 --- a/app/serializers/base_discussion_entity.rb +++ b/app/serializers/base_discussion_entity.rb @@ -40,16 +40,16 @@ class BaseDiscussionEntity < Grape::Entity expose :resolved_at expose :resolve_path do |discussion| - resolve_project_merge_request_discussion_path(discussion.project, discussion.noteable, discussion.id) + resolve_project_discussion_path(discussion.project, discussion.noteable_collection_name, discussion.noteable, discussion.id) end - expose :resolve_with_issue_path do |discussion| + expose :resolve_with_issue_path, if: -> (d, _) { d.noteable.is_a?(MergeRequest) } do |discussion| new_project_issue_path(discussion.project, merge_request_to_resolve_discussions_of: discussion.noteable.iid, discussion_to_resolve: discussion.id) if discussion&.project&.issues_enabled? end end expose :truncated_diff_lines_path, if: -> (d, _) { !d.expanded? && !render_truncated_diff_lines? } do |discussion| - project_merge_request_discussion_path(discussion.project, discussion.noteable, discussion) + project_discussion_path(discussion.project, discussion.noteable_collection_name, discussion.noteable, discussion) end private diff --git a/app/serializers/note_entity.rb b/app/serializers/note_entity.rb index 2155a1b4601..a50d893d244 100644 --- a/app/serializers/note_entity.rb +++ b/app/serializers/note_entity.rb @@ -78,10 +78,10 @@ class NoteEntity < API::Entities::Note end expose :resolve_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note| - resolve_project_merge_request_discussion_path(note.project, note.noteable, note.discussion_id) + resolve_project_discussion_path(discussion.project, discussion.noteable_collection_name, discussion.noteable, discussion.id) end - expose :resolve_with_issue_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note| + expose :resolve_with_issue_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? && note.noteable.is_a?(MergeRequest) } do |note| new_project_issue_path(note.project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id) end diff --git a/app/serializers/project_note_entity.rb b/app/serializers/project_note_entity.rb index 3cd34f6af0d..3e004fb5d32 100644 --- a/app/serializers/project_note_entity.rb +++ b/app/serializers/project_note_entity.rb @@ -21,14 +21,6 @@ class ProjectNoteEntity < NoteEntity project_note_path(note.project, note) end - expose :resolve_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note| - resolve_project_merge_request_discussion_path(note.project, note.noteable, note.discussion_id) - end - - expose :resolve_with_issue_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note| - new_project_issue_path(note.project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id) - end - expose :delete_attachment_path, if: -> (note, _) { note.attachment? } do |note| delete_attachment_project_note_path(note.project, note) end |