summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-08-17 00:38:31 +0000
committerJacob Schatz <jschatz@gitlab.com>2016-08-17 00:38:31 +0000
commit1b338d59f641ce629cbecb839b64c9fd65561276 (patch)
tree553665c1a24e4a264db52eee3b366fb4e7000d28
parent07189d7aed52e784adf4d625d94838b44668b28e (diff)
parent5dffd21cd526fadc3daa041fe88b60388dc786ed (diff)
downloadgitlab-ce-1b338d59f641ce629cbecb839b64c9fd65561276.tar.gz
Merge branch 'label-flash' into 'master'
Fix error message for existing labels in right sidebar. ## What does this MR do? Fixes flash notification in right sidebar, if we want to create an existing label. ## Are there points in the code the reviewer needs to double check? Nope. ## Why was this MR needed? Because it was broken. ## What are the relevant issue numbers? Fixes #20117 ## Screenshots (if relevant) #### Before ![https://gitlab.com/gitlab-org/gitlab-ce/uploads/c1fa7e98d1a3f0daaf8197809bbb26d0/Screen_Shot_2016-07-22_at_11.33.35.png](https://gitlab.com/gitlab-org/gitlab-ce/uploads/c1fa7e98d1a3f0daaf8197809bbb26d0/Screen_Shot_2016-07-22_at_11.33.35.png) #### After ![Screen_Shot_2016-07-28_at_13.38.03](/uploads/1dca73bf4c1b14c0044952a5032d9325/Screen_Shot_2016-07-28_at_13.38.03.png) ![Screen_Shot_2016-07-28_at_13.41.18](/uploads/9b814f7f03d0314050659e1ac6ace290/Screen_Shot_2016-07-28_at_13.41.18.png) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - [ ] ~~API support added~~ - Tests - [ ] ~~Added for this feature/bug~~ - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5546
-rw-r--r--CHANGELOG3
-rw-r--r--app/assets/javascripts/labels_select.js12
2 files changed, 10 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 2a7109b3c2b..e9c8a4895e1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -146,6 +146,9 @@ v 8.10.3
- Fix importer for GitHub Pull Requests when a branch was removed. !5573
- Ignore invalid IPs in X-Forwarded-For when trusted proxies are configured. !5584
- Trim extra displayed carriage returns in diffs and files with CRLFs. !5588
+ - Fix label already exist error message in the right sidebar.
+
+v 8.10.3 (unreleased)
v 8.10.2
- User can now search branches by name. !5144
diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js
index 675dd5b7cea..1bb0b67d0e8 100644
--- a/app/assets/javascripts/labels_select.js
+++ b/app/assets/javascripts/labels_select.js
@@ -70,13 +70,15 @@
name: newLabelField.val(),
color: newColorField.val()
}, function(label) {
- var errors;
$newLabelCreateButton.enable();
if (label.message != null) {
- errors = _.map(label.message, function(value, key) {
- return key + " " + value[0];
- });
- return $newLabelError.html(errors.join("<br/>")).show();
+ var errorText = label.message;
+ if (_.isObject(label.message)) {
+ errorText = _.map(label.message, function(value, key) {
+ return key + " " + value[0];
+ }).join('<br/>');
+ }
+ return $newLabelError.html(errorText).show();
} else {
return $('.dropdown-menu-back', $dropdown.parent()).trigger('click');
}