summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Knox <psimyn@gmail.com>2018-03-06 22:27:46 +1100
committerSimon Knox <psimyn@gmail.com>2018-03-06 22:27:46 +1100
commite99a5060094d85f97005831ce0a34759891a2279 (patch)
tree9c9d3ef63dab20ed97eeb88944de3e5592d2ccf4
parent5936ac30ceb39eee48f423e0726478c72803dc8b (diff)
downloadgitlab-ce-35475-lazy-diff.tar.gz
fix spec for loading note from url hash35475-lazy-diff
-rw-r--r--app/assets/javascripts/notes.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index fe9c9c4c66c..6d1b2f452c0 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -103,6 +103,13 @@ export default class Notes {
$('.note-edit-form').clone()
.addClass('mr-note-edit-form').insertAfter('.note-edit-form');
}
+
+ const hash = getLocationHash();
+ const $anchor = hash && document.getElementById(hash);
+
+ if ($anchor) {
+ this.loadLazyDiff({ currentTarget: $anchor });
+ }
}
setViewType(view) {
@@ -1248,7 +1255,7 @@ export default class Notes {
}
loadLazyDiff(e) {
- const $container = $(this).closest('.js-toggle-container');
+ const $container = $(e.currentTarget).closest('.js-toggle-container');
Notes.renderPlaceholderComponent($container);
$container.find('.js-toggle-lazy-diff').removeClass('js-toggle-lazy-diff');
@@ -1261,7 +1268,6 @@ export default class Notes {
axios.get(url)
.then(({ data }) => {
- if (window.failer) throw new Error();
Notes.renderDiffContent($container, data);
})
.catch(() => {