diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-06-20 02:43:08 +0300 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-06-20 02:52:19 +0300 |
commit | 19e12aac0217efae6b474d8601928a217064fb21 (patch) | |
tree | 8982e2c5cac148330a5bb5eb24e30b7f954eb847 /app/assets | |
parent | 025cbc2ad4dc175634676ff8a6955e043512d8bf (diff) |
Fix note highlight being added to new notes
Always use a explicit true/false value to set highlight because jQuery
assumes `null` means toggle from whatever state and doesn't force false.
Regressed in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12098
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/notes.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index f12a35f0485..6a6dabfd00c 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -322,7 +322,9 @@ const normalizeNewlines = function(str) { Notes.updateNoteTargetSelector = function($note) { const hash = gl.utils.getLocationHash(); - $note.toggleClass('target', hash && $note.filter(`#${hash}`).length > 0); + // Needs to be an explicit true/false for the jQuery `toggleClass(force)` + const addTargetClass = Boolean(hash && $note.filter(`#${hash}`).length > 0); + $note.toggleClass('target', addTargetClass); }; /* |