Moving an issue referencing a group in a note can fail
Summary
We attempted to move an issue from gitlab-com/support-forum
to gitlab-org/gitlab
via the API and it failed with the following exception:
A manual move resulted in the same exception:
Steps to reproduce
diff --git a/spec/lib/gitlab/gfm/reference_rewriter_spec.rb b/spec/lib/gitlab/gfm/reference_rewriter_spec.rb
index 084dde1f93f..6def64817f1 100644
--- a/spec/lib/gitlab/gfm/reference_rewriter_spec.rb
+++ b/spec/lib/gitlab/gfm/reference_rewriter_spec.rb
@@ -147,6 +147,18 @@ describe Gitlab::Gfm::ReferenceRewriter do
it { is_expected.to eq text }
end
+ context 'when referring to a group' do
+ let(:text) { "group @#{group.full_path}" }
+
+ it { is_expected.to eq text }
+ end
+
+ context 'when referring to an omitted group' do
+ let(:text) { "group `@#{group.full_path}`" }
+
+ it { is_expected.to eq text }
+ end
+
Results in
Failures:
1) Gitlab::Gfm::ReferenceRewriter#rewrite when referring to a group
Failure/Error:
def to_reference(_from = nil, full: nil)
"#{self.class.reference_prefix}#{full_path}"
end
ArgumentError:
unknown keyword: target_project
# ./app/models/group.rb:172:in `to_reference'
# ./lib/gitlab/gfm/reference_rewriter.rb:87:in `build_cross_reference'
# ./lib/gitlab/gfm/reference_rewriter.rb:65:in `unfold_reference'
# ./lib/gitlab/gfm/reference_rewriter.rb:48:in `block in rewrite'
# ./lib/gitlab/gfm/reference_rewriter.rb:47:in `gsub'
# ./lib/gitlab/gfm/reference_rewriter.rb:47:in `rewrite'
# ./spec/lib/gitlab/gfm/reference_rewriter_spec.rb:20:in `block (3 levels) in <top (required)>'
# ./spec/lib/gitlab/gfm/reference_rewriter_spec.rb:153:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:315:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:304:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:300:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:300:in `block (2 levels) in <top (required)>'
2) Gitlab::Gfm::ReferenceRewriter#rewrite when referring to an omitted group
Failure/Error:
def to_reference(_from = nil, full: nil)
"#{self.class.reference_prefix}#{full_path}"
end
ArgumentError:
unknown keyword: target_project
# ./app/models/group.rb:172:in `to_reference'
# ./lib/gitlab/gfm/reference_rewriter.rb:87:in `build_cross_reference'
# ./lib/gitlab/gfm/reference_rewriter.rb:65:in `unfold_reference'
# ./lib/gitlab/gfm/reference_rewriter.rb:48:in `block in rewrite'
# ./lib/gitlab/gfm/reference_rewriter.rb:47:in `gsub'
# ./lib/gitlab/gfm/reference_rewriter.rb:47:in `rewrite'
# ./spec/lib/gitlab/gfm/reference_rewriter_spec.rb:20:in `block (3 levels) in <top (required)>'
# ./spec/lib/gitlab/gfm/reference_rewriter_spec.rb:159:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:315:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:304:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:300:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:300:in `block (2 levels) in <top (required)>'
Example Project
What is the current bug behavior?
Issue move fails with an error
What is the expected correct behavior?
Issue should be moved
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
reproduced on GitLab.com 12.10
Results of GitLab application Check
reproduced on GitLab.com 12.10
Possible fixes
- Update the
Group#to_reference
method definition to have the keyword argument