Commit 64fcda29 authored by Constance Okoghenun's avatar Constance Okoghenun

Removed discard comment button

Removed the button and associated tests form notes
on Issues and Merge request page.
parent 465b3041
...@@ -51,8 +51,6 @@ export default class GLForm { ...@@ -51,8 +51,6 @@ export default class GLForm {
// form and textarea event listeners // form and textarea event listeners
this.addEventListeners(); this.addEventListeners();
addMarkdownListeners(this.form); addMarkdownListeners(this.form);
// hide discard button
this.form.find('.js-note-discard').hide();
this.form.show(); this.form.show();
if (this.isAutosizeable) this.setupAutosize(); if (this.isAutosizeable) this.setupAutosize();
} }
......
...@@ -138,8 +138,6 @@ export default class Notes { ...@@ -138,8 +138,6 @@ export default class Notes {
this.$wrapperEl.on('click', '.js-note-delete', this.removeNote); this.$wrapperEl.on('click', '.js-note-delete', this.removeNote);
// delete note attachment // delete note attachment
this.$wrapperEl.on('click', '.js-note-attachment-delete', this.removeAttachment); this.$wrapperEl.on('click', '.js-note-attachment-delete', this.removeAttachment);
// reset main target form when clicking discard
this.$wrapperEl.on('click', '.js-note-discard', this.resetMainTargetForm);
// update the file name when an attachment is selected // update the file name when an attachment is selected
this.$wrapperEl.on('change', '.js-note-attachment-input', this.updateFormAttachment); this.$wrapperEl.on('change', '.js-note-attachment-input', this.updateFormAttachment);
// reply to diff/discussion notes // reply to diff/discussion notes
...@@ -191,7 +189,6 @@ export default class Notes { ...@@ -191,7 +189,6 @@ export default class Notes {
this.$wrapperEl.off('keyup input', '.js-note-text'); this.$wrapperEl.off('keyup input', '.js-note-text');
this.$wrapperEl.off('click', '.js-note-target-reopen'); this.$wrapperEl.off('click', '.js-note-target-reopen');
this.$wrapperEl.off('click', '.js-note-target-close'); this.$wrapperEl.off('click', '.js-note-target-close');
this.$wrapperEl.off('click', '.js-note-discard');
this.$wrapperEl.off('keydown', '.js-note-text'); this.$wrapperEl.off('keydown', '.js-note-text');
this.$wrapperEl.off('click', '.js-comment-resolve-button'); this.$wrapperEl.off('click', '.js-comment-resolve-button');
this.$wrapperEl.off('click', '.system-note-commit-list-toggler'); this.$wrapperEl.off('click', '.system-note-commit-list-toggler');
...@@ -985,12 +982,6 @@ export default class Notes { ...@@ -985,12 +982,6 @@ export default class Notes {
// DiffNote // DiffNote
form.find('#note_position').val(dataHolder.attr('data-position')); form.find('#note_position').val(dataHolder.attr('data-position'));
form
.find('.js-note-discard')
.show()
.removeClass('js-note-discard')
.addClass('js-close-discussion-note-form')
.text(form.find('.js-close-discussion-note-form').data('cancelText'));
form.find('.js-note-target-close').remove(); form.find('.js-note-target-close').remove();
form.find('.js-note-new-discussion').remove(); form.find('.js-note-new-discussion').remove();
this.setupNoteForm(form); this.setupNoteForm(form);
...@@ -1194,12 +1185,11 @@ export default class Notes { ...@@ -1194,12 +1185,11 @@ export default class Notes {
} }
updateTargetButtons(e) { updateTargetButtons(e) {
var closebtn, closetext, discardbtn, form, reopenbtn, reopentext, textarea; var closebtn, closetext, form, reopenbtn, reopentext, textarea;
textarea = $(e.target); textarea = $(e.target);
form = textarea.parents('form'); form = textarea.parents('form');
reopenbtn = form.find('.js-note-target-reopen'); reopenbtn = form.find('.js-note-target-reopen');
closebtn = form.find('.js-note-target-close'); closebtn = form.find('.js-note-target-close');
discardbtn = form.find('.js-note-discard');
if (textarea.val().trim().length > 0) { if (textarea.val().trim().length > 0) {
reopentext = reopenbtn.attr('data-alternative-text'); reopentext = reopenbtn.attr('data-alternative-text');
...@@ -1216,9 +1206,6 @@ export default class Notes { ...@@ -1216,9 +1206,6 @@ export default class Notes {
if (closebtn.is(':not(.btn-comment-and-close)')) { if (closebtn.is(':not(.btn-comment-and-close)')) {
closebtn.addClass('btn-comment-and-close'); closebtn.addClass('btn-comment-and-close');
} }
if (discardbtn.is(':hidden')) {
return discardbtn.show();
}
} else { } else {
reopentext = reopenbtn.data('originalText'); reopentext = reopenbtn.data('originalText');
closetext = closebtn.data('originalText'); closetext = closebtn.data('originalText');
...@@ -1234,9 +1221,6 @@ export default class Notes { ...@@ -1234,9 +1221,6 @@ export default class Notes {
if (closebtn.is('.btn-comment-and-close')) { if (closebtn.is('.btn-comment-and-close')) {
closebtn.removeClass('btn-comment-and-close'); closebtn.removeClass('btn-comment-and-close');
} }
if (discardbtn.is(':visible')) {
return discardbtn.hide();
}
} }
} }
......
...@@ -431,15 +431,6 @@ append-right-10 comment-type-dropdown js-comment-type-dropdown droplab-dropdown" ...@@ -431,15 +431,6 @@ append-right-10 comment-type-dropdown js-comment-type-dropdown droplab-dropdown"
:label="issueActionButtonTitle" :label="issueActionButtonTitle"
@click="handleSave(true);" @click="handleSave(true);"
/> />
<button
v-if="note.length"
type="button"
class="btn btn-cancel js-note-discard"
@click="discard"
>
Discard draft
</button>
</div> </div>
</form> </form>
</div> </div>
......
...@@ -39,6 +39,3 @@ ...@@ -39,6 +39,3 @@
= render partial: 'shared/notes/comment_button' = render partial: 'shared/notes/comment_button'
= yield(:note_actions) = yield(:note_actions)
%a.btn.btn-cancel.js-note-discard{ role: "button", data: {cancel_text: "Cancel" } }
Discard draft
---
title: Removed discard draft comment button form notes
merge_request: 24185
author:
type: removed
...@@ -223,7 +223,6 @@ describe('issue_comment_form component', () => { ...@@ -223,7 +223,6 @@ describe('issue_comment_form component', () => {
'Comment & close issue', 'Comment & close issue',
); );
expect(vm.$el.querySelector('.js-note-discard')).toBeDefined();
done(); done();
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment