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
This commit is contained in:
Jacob Schatz 2016-08-17 00:38:31 +00:00
commit 1b338d59f6
2 changed files with 10 additions and 5 deletions

View File

@ -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

View File

@ -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');
}