Commit 4d70fc58 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Do not initialize comment type toggle if form is not available

This is for when user has not logged in
parent 9ee6b0ce
......@@ -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));
}
};
/*
......
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