diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 06:10:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 06:10:04 +0300 |
commit | fefca4c7b96dddf0afcd34f33be8bf249448918b (patch) | |
tree | aba2b19e32894ff00067e940bfaf20732da8aca3 /app | |
parent | b5452c76b5b35884482214dbf6fe9971e0276d3b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/services/issuable/clone/base_service.rb | 4 | ||||
-rw-r--r-- | app/services/markdown_content_rewriter_service.rb | 4 | ||||
-rw-r--r-- | app/services/notes/copy_service.rb | 6 |
3 files changed, 8 insertions, 6 deletions
diff --git a/app/services/issuable/clone/base_service.rb b/app/services/issuable/clone/base_service.rb index 639423ed4bf..b2f9c083b5b 100644 --- a/app/services/issuable/clone/base_service.rb +++ b/app/services/issuable/clone/base_service.rb @@ -44,7 +44,7 @@ module Issuable current_user, original_entity.description, original_entity.project, - new_entity.project + new_parent ).execute new_entity.update!(description: rewritten_description) @@ -69,7 +69,7 @@ module Issuable end def new_parent - new_entity.project || new_entity.group + new_entity.resource_parent end def group diff --git a/app/services/markdown_content_rewriter_service.rb b/app/services/markdown_content_rewriter_service.rb index f945990a1b4..bc6fd592eaa 100644 --- a/app/services/markdown_content_rewriter_service.rb +++ b/app/services/markdown_content_rewriter_service.rb @@ -7,6 +7,10 @@ class MarkdownContentRewriterService REWRITERS = [Gitlab::Gfm::ReferenceRewriter, Gitlab::Gfm::UploadsRewriter].freeze def initialize(current_user, content, source_parent, target_parent) + # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39654#note_399095117 + raise ArgumentError, 'The rewriter classes require that `source_parent` is a `Project`' \ + unless source_parent.is_a?(Project) + @current_user = current_user @content = content.presence @source_parent = source_parent diff --git a/app/services/notes/copy_service.rb b/app/services/notes/copy_service.rb index 31aaa219922..6e5b4596602 100644 --- a/app/services/notes/copy_service.rb +++ b/app/services/notes/copy_service.rb @@ -13,7 +13,6 @@ module Notes @from_noteable = from_noteable @to_noteable = to_noteable @from_project = from_noteable.project - @to_project = to_noteable.project @new_discussion_ids = {} end @@ -27,8 +26,7 @@ module Notes private - attr_reader :from_noteable, :to_noteable, :from_project, :to_project, - :current_user, :new_discussion_ids + attr_reader :from_noteable, :to_noteable, :from_project, :current_user, :new_discussion_ids def copy_note(note) new_note = note.dup @@ -40,7 +38,7 @@ module Notes def params_from_note(note, new_note) new_discussion_ids[note.discussion_id] ||= Discussion.discussion_id(new_note) - rewritten_note = MarkdownContentRewriterService.new(current_user, note.note, from_project, to_project).execute + rewritten_note = MarkdownContentRewriterService.new(current_user, note.note, from_project, to_noteable.resource_parent).execute new_params = { project: to_noteable.project, |