Fix draftless_title to strip all draft prefixes

What does this MR do?

Mark as ready only stripped the first Draft:/[Draft]/(Draft) prefix from an MR title. If a title had more than one (e.g. Draft: Draft: Fix a thing), one prefix was always left behind and the MR stayed in draft state.

MergeRequest.draftless_title now loops its sub call until no prefix remains, instead of removing just one.

Why

DRAFT_REGEX's + quantifier can't repeat past the first match because the interpolated sub-pattern carries its own \A anchor, which only matches at the very start of the string. Looping sub sidesteps this without touching the shared regex (also used by Commit::DRAFT_REGEX).

References

#607897 (closed)

Merge request reports

Loading
Loading