From 6b9f41a3f29d76ed2fd113e2056adc122e80ead5 Mon Sep 17 00:00:00 2001 From: kushalpandya Date: Thu, 11 May 2017 15:19:16 +0530 Subject: Remove unused `stripSlashCommand` method --- app/assets/javascripts/notes.js | 12 ------------ spec/javascripts/notes_spec.js | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 2b4a1a474e3..b29a27b7d37 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -1147,18 +1147,6 @@ const normalizeNewlines = function(str) { }; }; - /** - * Remove slash commands and leave comment with pure message - * this command is very less likely to be used in production - * as gl.GfmAutoComplete.cachedData['/'] is initialized the moment - * user starts typing any slash command, but during Karma tests - * it is not available - */ - Notes.prototype.stripSlashCommands = function (formContent) { - const REGEX_SLASH_COMMANDS = /\/\w+/g; - return formContent.replace(REGEX_SLASH_COMMANDS, '').trim(); - }; - /** * Identify if formContent has any slash commands * and generates placeholder note's content. diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js index 0c4cd07134f..12cf3661ed7 100644 --- a/spec/javascripts/notes_spec.js +++ b/spec/javascripts/notes_spec.js @@ -371,18 +371,6 @@ import '~/notes'; }); }); - describe('stripSlashCommands', () => { - const REGEX_SLASH_COMMANDS = /\/\w+/g; - - it('should strip slash commands from the comment', () => { - this.notes = new Notes(); - const sampleComment = '/wip /milestone %1.0 /merge /unassign Merging this'; - const stripedComment = this.notes.stripSlashCommands(sampleComment); - - expect(REGEX_SLASH_COMMANDS.test(stripedComment)).toBeFalsy(); - }); - }); - describe('generatePlaceholderNoteContent', () => { const availableSlashCommands = [ { name: 'close', description: 'Close this issue', params: [] }, -- cgit v1.2.1