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:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-12-10 01:49:08 +0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2016-12-13 18:59:23 +0300
commit06a0a5d72bba61d0e23a465b78d2c0ca72d89b78 (patch)
tree803bdbc02718b2bb0ea5102a00afeb93916dd7bc
parentd8595b0bc2323d079e5b98926db683b24d91f4a7 (diff)
Merge branch 'issue_24020' into 'master'
fix display hook error message ## What does this MR do? Fix hook error message display. ## Are there points in the code the reviewer needs to double check? Probably Hook will return the plain multi line text. It is better `pre` tag than `h4`. I thought of another good looking display, but I did not come up with it. :sweat: ## Why was this MR needed? When the hook returns an STDERR, "Merge in progress" button spinning forever. Due to javascript's error. ## Screenshots (if relevant) When update hook returns an error like ``` XXXXXXXX YYYYYYYY ZZZZZZZZ ``` ![screen_shot](/uploads/8dac77972a309dfcb72c741dffbd7270/screen_shot.png) ## What are the relevant issue numbers? Closes #24020 See merge request !7775
-rw-r--r--app/assets/javascripts/merge_request_widget.js.es62
-rw-r--r--changelogs/unreleased/issue_24020.yml4
-rw-r--r--spec/javascripts/merge_request_widget_spec.js12
3 files changed, 17 insertions, 1 deletions
diff --git a/app/assets/javascripts/merge_request_widget.js.es6 b/app/assets/javascripts/merge_request_widget.js.es6
index a55fe9df0b3..d9495e50388 100644
--- a/app/assets/javascripts/merge_request_widget.js.es6
+++ b/app/assets/javascripts/merge_request_widget.js.es6
@@ -101,7 +101,7 @@
urlSuffix = deleteSourceBranch ? '?deleted_source_branch=true' : '';
return window.location.href = window.location.pathname + urlSuffix;
} else if (data.merge_error) {
- return this.$widgetBody.html("<h4>" + data.merge_error + "</h4>");
+ return _this.$widgetBody.html("<h4>" + data.merge_error + "</h4>");
} else {
callback = function() {
return merge_request_widget.mergeInProgress(deleteSourceBranch);
diff --git a/changelogs/unreleased/issue_24020.yml b/changelogs/unreleased/issue_24020.yml
new file mode 100644
index 00000000000..87310b75296
--- /dev/null
+++ b/changelogs/unreleased/issue_24020.yml
@@ -0,0 +1,4 @@
+---
+title: "fix display hook error message"
+merge_request: 7775
+author: basyura
diff --git a/spec/javascripts/merge_request_widget_spec.js b/spec/javascripts/merge_request_widget_spec.js
index 62890f1ca96..6f91529db00 100644
--- a/spec/javascripts/merge_request_widget_spec.js
+++ b/spec/javascripts/merge_request_widget_spec.js
@@ -106,6 +106,18 @@
});
});
+ describe('mergeInProgress', function() {
+ it('should display error with h4 tag', function() {
+ spyOn(this.class.$widgetBody, 'html').and.callFake(function(html) {
+ expect(html).toBe('<h4>Sorry, something went wrong.</h4>');
+ });
+ spyOn($, 'ajax').and.callFake(function(e) {
+ e.success({ merge_error: 'Sorry, something went wrong.' });
+ });
+ this.class.mergeInProgress(null);
+ });
+ });
+
return describe('getCIStatus', function() {
beforeEach(function() {
this.ciStatusData = {