Skip to content
Snippets Groups Projects
Commit 1e0c6439 authored by Sam Rose's avatar Sam Rose Committed by Phil Hughes
Browse files

Disable reference prefixes in notes for Snippets

parent 0b52808f
No related branches found
No related tags found
1 merge request!12073Add RC2 changes to 9-3-stable
Loading
Loading
@@ -7,9 +7,10 @@ import GfmAutoComplete from './gfm_auto_complete';
 
window.gl = window.gl || {};
 
function GLForm(form) {
function GLForm(form, enableGFM = false) {
this.form = form;
this.textarea = this.form.find('textarea.js-gfm-input');
this.enableGFM = enableGFM;
// Before we start, we should clean up any previous data for this form
this.destroy();
// Setup the form
Loading
Loading
@@ -32,8 +33,14 @@ GLForm.prototype.setupForm = function() {
this.form.addClass('gfm-form');
// remove notify commit author checkbox for non-commit notes
gl.utils.disableButtonIfEmptyField(this.form.find('.js-note-text'), this.form.find('.js-comment-button, .js-note-new-discussion'));
new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources).setup(this.form.find('.js-gfm-input'));
new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources).setup(this.form.find('.js-gfm-input'), {
emojis: true,
members: this.enableGFM,
issues: this.enableGFM,
milestones: this.enableGFM,
mergeRequests: this.enableGFM,
labels: this.enableGFM,
});
new DropzoneInput(this.form);
autosize(this.textarea);
}
Loading
Loading
Loading
Loading
@@ -27,7 +27,7 @@ const normalizeNewlines = function(str) {
 
Notes.interval = null;
 
function Notes(notes_url, note_ids, last_fetched_at, view) {
function Notes(notes_url, note_ids, last_fetched_at, view, enableGFM = true) {
this.updateTargetButtons = this.updateTargetButtons.bind(this);
this.updateComment = this.updateComment.bind(this);
this.visibilityChange = this.visibilityChange.bind(this);
Loading
Loading
@@ -50,6 +50,7 @@ const normalizeNewlines = function(str) {
 
this.notes_url = notes_url;
this.note_ids = note_ids;
this.enableGFM = enableGFM;
// Used to keep track of updated notes while people are editing things
this.updatedNotesTrackingMap = {};
this.last_fetched_at = last_fetched_at;
Loading
Loading
@@ -523,7 +524,7 @@ const normalizeNewlines = function(str) {
 
Notes.prototype.setupNoteForm = function(form) {
var textarea, key;
new gl.GLForm(form);
new gl.GLForm(form, this.enableGFM);
textarea = form.find(".js-note-text");
key = [
"Note",
Loading
Loading
Loading
Loading
@@ -23,4 +23,4 @@
to post a comment
 
:javascript
var notes = new Notes("#{notes_url}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}, "#{diff_view}")
var notes = new Notes("#{notes_url}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}, "#{diff_view}", false)
---
title: Disable reference prefixes in notes for Snippets
merge_request: 11278
author:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment