Commit 71832ab5 authored by Jacques Erasmus's avatar Jacques Erasmus

Merge branch 'ph/228685/removeWipToggleSupport' into 'master'

Removes support for WIP in the title toggle button

See merge request gitlab-org/gitlab!61716
parents e0351ad9 3a9edf30
...@@ -54,9 +54,9 @@ export default class IssuableForm { ...@@ -54,9 +54,9 @@ export default class IssuableForm {
this.wipRegex = new RegExp( this.wipRegex = new RegExp(
'^\\s*(' + // Line start, then any amount of leading whitespace '^\\s*(' + // Line start, then any amount of leading whitespace
'draft\\s-\\s' + // Draft_-_ where "_" are *exactly* one whitespace 'draft\\s-\\s' + // Draft_-_ where "_" are *exactly* one whitespace
'|\\[(draft|wip)\\]\\s*' + // [Draft] or [WIP] and any following whitespace '|\\[draft\\]\\s*' + // [Draft] or [WIP] and any following whitespace
'|(draft|wip):\\s*' + // Draft: or WIP: and any following whitespace '|draft:\\s*' + // Draft: or WIP: and any following whitespace
'|(draft|wip)\\s+' + // Draft_ or WIP_ where "_" is at least one whitespace '|draft\\s+' + // Draft_ or WIP_ where "_" is at least one whitespace
'|\\(draft\\)\\s*' + // (Draft) and any following whitespace '|\\(draft\\)\\s*' + // (Draft) and any following whitespace
')+' + // At least one repeated match of the preceding parenthetical ')+' + // At least one repeated match of the preceding parenthetical
'\\s*', // Any amount of trailing whitespace '\\s*', // Any amount of trailing whitespace
...@@ -146,18 +146,12 @@ export default class IssuableForm { ...@@ -146,18 +146,12 @@ export default class IssuableForm {
workInProgress() { workInProgress() {
return this.wipRegex.test(this.titleField.val()); return this.wipRegex.test(this.titleField.val());
} }
titlePrefixContainsDraft() {
const prefix = this.titleField.val().match(this.wipRegex);
return prefix && prefix[0].match(/draft/i);
}
renderWipExplanation() { renderWipExplanation() {
if (this.workInProgress()) { if (this.workInProgress()) {
// These strings are not "translatable" (the code is hard-coded to look for them) // These strings are not "translatable" (the code is hard-coded to look for them)
this.$wipExplanation.find('code')[0].textContent = this.titlePrefixContainsDraft() this.$wipExplanation.find('code')[0].textContent =
? 'Draft' /* eslint-disable-line @gitlab/require-i18n-strings */ 'Draft'; /* eslint-disable-line @gitlab/require-i18n-strings */
: 'WIP';
this.$wipExplanation.show(); this.$wipExplanation.show();
return this.$noWipExplanation.hide(); return this.$noWipExplanation.hide();
} }
......
...@@ -5,11 +5,8 @@ ...@@ -5,11 +5,8 @@
- div_class = no_issuable_templates ? 'col-sm-10' : 'col-sm-7 col-lg-8' - div_class = no_issuable_templates ? 'col-sm-10' : 'col-sm-7 col-lg-8'
- toggle_wip_link_start = '<a href="" class="js-toggle-wip">' - toggle_wip_link_start = '<a href="" class="js-toggle-wip">'
- toggle_wip_link_end = '</a>' - toggle_wip_link_end = '</a>'
- draft_snippet = '<code>Draft:</code>'.html_safe - add_wip_text = (_('%{link_start}Start the title with %{draft_snippet}%{link_end} to prevent a merge request that is a work in progress from being merged before it\'s ready.') % { link_start: toggle_wip_link_start, link_end: toggle_wip_link_end, draft_snippet: '<code>Draft:</code>'.html_safe } ).html_safe
- wip_snippet = '<code>WIP:</code>'.html_safe - remove_wip_text = (_('%{link_start}Remove the %{draft_snippet} prefix%{link_end} from the title to allow this merge request to be merged when it\'s ready.' ) % { link_start: toggle_wip_link_start, link_end: toggle_wip_link_end, draft_snippet: '<code>Draft</code>'.html_safe } ).html_safe
- draft_or_wip_snippet = '<code>Draft/WIP</code>'.html_safe
- add_wip_text = (_('%{link_start}Start the title with %{draft_snippet} or %{wip_snippet}%{link_end} to prevent a merge request that is a work in progress from being merged before it\'s ready.') % { link_start: toggle_wip_link_start, link_end: toggle_wip_link_end, draft_snippet: draft_snippet, wip_snippet: wip_snippet } ).html_safe
- remove_wip_text = (_('%{link_start}Remove the %{draft_or_wip_snippet} prefix%{link_end} from the title to allow this merge request to be merged when it\'s ready.' ) % { link_start: toggle_wip_link_start, link_end: toggle_wip_link_end, draft_or_wip_snippet: draft_or_wip_snippet } ).html_safe
%div{ class: div_class } %div{ class: div_class }
= form.text_field :title, required: true, maxlength: 255, autofocus: true, = form.text_field :title, required: true, maxlength: 255, autofocus: true,
......
---
title: Remove support for WIP in merge request title toggle
merge_request:
author:
type: removed
...@@ -663,10 +663,10 @@ msgstr "" ...@@ -663,10 +663,10 @@ msgstr ""
msgid "%{link_start}Read more%{link_end} about role permissions" msgid "%{link_start}Read more%{link_end} about role permissions"
msgstr "" msgstr ""
msgid "%{link_start}Remove the %{draft_or_wip_snippet} prefix%{link_end} from the title to allow this merge request to be merged when it's ready." msgid "%{link_start}Remove the %{draft_snippet} prefix%{link_end} from the title to allow this merge request to be merged when it's ready."
msgstr "" msgstr ""
msgid "%{link_start}Start the title with %{draft_snippet} or %{wip_snippet}%{link_end} to prevent a merge request that is a work in progress from being merged before it's ready." msgid "%{link_start}Start the title with %{draft_snippet}%{link_end} to prevent a merge request that is a work in progress from being merged before it's ready."
msgstr "" msgstr ""
msgid "%{listToShow}, and %{awardsListLength} more." msgid "%{listToShow}, and %{awardsListLength} more."
......
...@@ -46,7 +46,7 @@ RSpec.describe 'Merge request > User sees draft help message' do ...@@ -46,7 +46,7 @@ RSpec.describe 'Merge request > User sees draft help message' do
'It looks like you have some draft commits in this branch' 'It looks like you have some draft commits in this branch'
) )
expect(page).to have_text( expect(page).to have_text(
"Start the title with Draft: or WIP: to prevent a merge request that is a \ "Start the title with Draft: to prevent a merge request that is a \
work in progress from being merged before it's ready." work in progress from being merged before it's ready."
) )
end end
......
...@@ -20,11 +20,6 @@ describe('IssuableForm', () => { ...@@ -20,11 +20,6 @@ describe('IssuableForm', () => {
describe('removeWip', () => { describe('removeWip', () => {
it.each` it.each`
prefix prefix
${'wip '}
${' wIP: '}
${'[WIp] '}
${'wIP:'}
${' [WIp]'}
${'drAft '} ${'drAft '}
${'draFT: '} ${'draFT: '}
${' [DRaft] '} ${' [DRaft] '}
...@@ -34,7 +29,7 @@ describe('IssuableForm', () => { ...@@ -34,7 +29,7 @@ describe('IssuableForm', () => {
${'dRaFt - '} ${'dRaFt - '}
${'(draft) '} ${'(draft) '}
${' (DrafT)'} ${' (DrafT)'}
${'wip wip: [wip] draft draft - draft: [draft] (draft)'} ${'draft draft - draft: [draft] (draft)'}
`('removes "$prefix" from the beginning of the title', ({ prefix }) => { `('removes "$prefix" from the beginning of the title', ({ prefix }) => {
instance.titleField.val(`${prefix}The Issuable's Title Value`); instance.titleField.val(`${prefix}The Issuable's Title Value`);
......
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