summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-04-05 20:24:08 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2017-04-05 23:01:43 -0500
commit4d70fc581015bf1146b4182c855978e1ca67dd8c (patch)
tree5012f0090903a4f4a04c5e0b7a7c9466aee8a320
parent9ee6b0ce8f6a772a5f19def7d840fe96b3d0fca6 (diff)
downloadgitlab-ce-4d70fc581015bf1146b4182c855978e1ca67dd8c.tar.gz
Do not initialize comment type toggle if form is not available
This is for when user has not logged in
-rw-r--r--app/assets/javascripts/notes.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 85817bc2cf9..d595b48d301 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -140,10 +140,10 @@ require('./task_list');
Notes.prototype.initCommentTypeToggle = function (form) {
this.commentTypeToggle = new CommentTypeToggle(
- form[0].querySelector('.js-comment-type-dropdown .dropdown-toggle'),
- form[0].querySelector('.js-comment-type-dropdown .dropdown-menu'),
+ form.querySelector('.js-comment-type-dropdown .dropdown-toggle'),
+ form.querySelector('.js-comment-type-dropdown .dropdown-menu'),
document.getElementById('note_type'),
- form[0].querySelector('.js-comment-type-dropdown .js-comment-submit-button'),
+ form.querySelector('.js-comment-type-dropdown .js-comment-submit-button'),
document.querySelector('.js-note-target-close'),
);
@@ -470,7 +470,9 @@ require('./task_list');
form.find('.js-comment-resolve-button').closest('comment-and-resolve-btn').remove();
this.parentTimeline = form.parents('.timeline');
- this.initCommentTypeToggle(form);
+ if (form.length) {
+ this.initCommentTypeToggle(form.get(0));
+ }
};
/*