Skip to content

Display errors in UI correctly when creating notes

What does this MR do and why?

Screenshots or screen recordings

Context Before After
adding a note adding-note-before adding-note-after
adding a note (snippet i.e. deprecated_notes.js) adding-deprecated-note-before adding-deprecated-note-after
replying to discussion replying-to-discussion-before replying-to-discussion-after

How to set up and validate locally

  1. Add a validator to the app/models/note.rb model since we don't have an easy validation we can test against in the Note model.
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. Navigate to any issue / merge request / snippet / commit and add a note with TEST_VALIDATION.

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

Loading