Commit a99f6c34 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '204774-quick-actions-executed-in-multiline-inline-code' into 'master'

204774 Quick actions executed in multiline inline code, when placed on it's own line

Closes #204774

See merge request gitlab-org/gitlab!24933
parents 1606a8b8 d5926290
---
title: Fix quick actions executing in multiline inline code when placed on its own line
merge_request: 24933
author: Pavlo Dudchenko
type: fixed
......@@ -105,6 +105,17 @@ module Gitlab
.+?
\n```$
)
|
(?<inline_code>
# Inline code on separate rows:
# `
# Anything, including `/cmd arg` which are ignored by this filter
# `
^.*`\n*
.+?
\n*`$
)
|
(?<html>
# HTML block:
......
......@@ -291,6 +291,33 @@ describe Gitlab::QuickActions::Extractor do
expect(msg).to eq expected
end
it 'does not extract commands in multiline inline code on seperated rows' do
msg = "Hello\r\n`\r\nThis is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld"
expected = msg.delete("\r")
msg, commands = extractor.extract_commands(msg)
expect(commands).to be_empty
expect(msg).to eq expected
end
it 'does not extract commands in multiline inline code starting from text' do
msg = "Hello `This is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld"
expected = msg.delete("\r")
msg, commands = extractor.extract_commands(msg)
expect(commands).to be_empty
expect(msg).to eq expected
end
it 'does not extract commands in inline code' do
msg = "`This is some text\r\n/close\r\n/assign @user\r\n`\r\n\r\nWorld"
expected = msg.delete("\r")
msg, commands = extractor.extract_commands(msg)
expect(commands).to be_empty
expect(msg).to eq expected
end
it 'limits to passed commands when they are passed' do
msg = <<~MSG.strip
Hello, we should only extract the commands passed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment