Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-04-12 19:29:54 +0300
committerFilipa Lacerda <filipa@gitlab.com>2018-04-12 19:29:54 +0300
commitb01fd7ad81524b5f2773ccba4b5789a6074ffb9d (patch)
tree3fd1a32596b0b1127e07686e8878be692ee0be9e /app/assets/javascripts/notes.js
parent1e54e30ffc017efa350e2f372513aa55b5a0bd0c (diff)
Fixes unresolved discussions rendering the error state instead of the diff
Diffstat (limited to 'app/assets/javascripts/notes.js')
-rw-r--r--app/assets/javascripts/notes.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index ac70ddb3ff4..184f335809d 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -19,7 +19,7 @@ import AjaxCache from '~/lib/utils/ajax_cache';
import Vue from 'vue';
import syntaxHighlight from '~/syntax_highlight';
import SkeletonLoadingContainer from '~/vue_shared/components/skeleton_loading_container.vue';
-import { __ } from '~/locale';
+import { __, sprintf } from '~/locale';
import axios from './lib/utils/axios_utils';
import { getLocationHash } from './lib/utils/url_utility';
import Flash from './flash';
@@ -1434,10 +1434,11 @@ export default class Notes {
static renderDiffError($container) {
$container.find('.line_content').html(
$(`
- <div class="nothing-here-block">
- ${__(
- 'Unable to load the diff.',
- )} <a class="js-toggle-lazy-diff" href="javascript:void(0)">Try again</a>?
+ <div class="js-error-load-lazy-diff nothing-here-block">
+ ${sprintf(__('Unable to load the diff.%{buttonStartTag}Try again%{buttonEndTag}?'), {
+ buttonStartTag: '<button type="button" class="btn-link btn-no-padding js-toggle-lazy-diff">',
+ buttonEndTag: '</button>'
+ }, false)}
</div>
`),
);
@@ -1455,7 +1456,12 @@ export default class Notes {
const fileHolder = $container.find('.file-holder');
const url = fileHolder.data('linesPath');
- axios
+ /**
+ * We only fetch resolved discussions.
+ * Unresolved discussions don't have an endpoint being provided.
+ */
+ if (url) {
+ axios
.get(url)
.then(({ data }) => {
Notes.renderDiffContent($container, data);
@@ -1463,6 +1469,7 @@ export default class Notes {
.catch(() => {
Notes.renderDiffError($container);
});
+ }
}
toggleCommitList(e) {