Skip to content

Fix validation in UI when updating a draft note in MR diff

Hinam Mehra requested to merge 411329-fix-draft-note-update-validation into master

What does this MR do and why?

Screenshots or screen recordings

Before After
before after

How to set up and validate locally

  1. Create a Merge Request with at least 1 file change and 1 image file added.
  2. Add a validator DraftNote class since we don't have a lot of validations for comments.
# Add it to class DraftNote < ApplicationRecord in models folder

validate :test_ui_validation, on: [:create, :update]

def test_ui_validation
    if note.include? 'TEST_VALIDATION'
      self.errors.add(:base,  _('it failed validation'))
    end
end
  1. Try to add comment TEST_VALIDATION in the Changes section and click on Start a review or Add to review.

MR acceptance checklist

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

Related to #411329

Edited by Hinam Mehra

Merge request reports