Skip to content

Show default value in squash and merge commit template textareas

What does this MR do and why?

Solves #348707 (closed)

Shows default value in a textareas for squash and merge commit templates instead of placeholders.

At the same time, it persists nil to database instead when default value is used.

This fixes rendering problem for placeholder with new lines (it does not render in Safari, possibly others).

Screenshots or screen recordings

For projects without any value set:

before

image

Plus on safari the placeholder doesn't render correctly:

image

After - default values are prefilled in textareas:

image

After - when user clears the values:

image

Note that for merge suggestions I've only added the help text. It's a one line text field, so there's no issue with placeholder there.

How to set up and validate locally

  1. Go to any project -> settings -> general.
  2. Expand Merge Requests section.
  3. Check that "Merge commit message template" and "Squash commit message template" is prefilled with default values.
  4. Change the value and confirm that it updated in DB.
  5. Change back to default value and confirm that it is nil in DB, but shows as default value in textarea.
  6. Change to empty value and confirm that it is nil in DB, but shows as default value in textarea.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Michael Kozono

Merge request reports