- if note.valid?
  :plain
    $(".note-form-holder .error").remove();
    $('.note-form-holder textarea').val("");
    $('.note-form-holder #preview-link').text('Preview');
    $('.note-form-holder #preview-note').hide();
    $('.note-form-holder').show();
    NoteList.appendNewNote(#{note.id}, "#{escape_javascript(render "notes/note", note: note)}");

- else
  :plain
    $(".note-form-holder").replaceWith("#{escape_javascript(render 'form')}");

    GitLab.GfmAutoComplete.setup();

- if note.valid?
  :plain
    $(".note-form-holder .error").remove();
    $('.note-form-holder textarea').val("");
    $('.note-form-holder #preview-link').text('Preview');
    $('.note-form-holder #preview-note').hide();
    $('.note-form-holder').show();
    NoteList.appendNewNote(#{note.id}, "#{escape_javascript(render "notes/note", note: note)}");

- else
  :plain
    $(".note-form-holder").replaceWith("#{escape_javascript(render 'notes/common_form')}");
    GitLab.GfmAutoComplete.setup();

Fix rendering template for invalid notes
Fix rendering template for invalid notes
