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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 12:06:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 12:06:30 +0300
commite24153b0cb080b1b25076f8fd358b4273848f2e2 (patch)
treeb3fc6d552241905fa927db14f8920c4809e74a6f /app/assets/javascripts/new_branch_form.js
parent3fe34368770022c88fd89c8df58b39bf0789e646 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/new_branch_form.js')
-rw-r--r--app/assets/javascripts/new_branch_form.js28
1 files changed, 12 insertions, 16 deletions
diff --git a/app/assets/javascripts/new_branch_form.js b/app/assets/javascripts/new_branch_form.js
index 9f9db21d65b..52361e963bc 100644
--- a/app/assets/javascripts/new_branch_form.js
+++ b/app/assets/javascripts/new_branch_form.js
@@ -1,4 +1,4 @@
-/* eslint-disable func-names, no-var, one-var, consistent-return, no-return-assign, no-shadow, no-else-return, @gitlab/i18n/no-non-i18n-strings */
+/* eslint-disable func-names, consistent-return, no-return-assign, no-else-return, @gitlab/i18n/no-non-i18n-strings */
import $ from 'jquery';
import RefSelectDropdown from './ref_select_dropdown';
@@ -26,23 +26,22 @@ export default class NewBranchForm {
}
setupRestrictions() {
- var endsWith, invalid, single, startsWith;
- startsWith = {
+ const startsWith = {
pattern: /^(\/|\.)/g,
prefix: "can't start with",
conjunction: 'or',
};
- endsWith = {
+ const endsWith = {
pattern: /(\/|\.|\.lock)$/g,
prefix: "can't end in",
conjunction: 'or',
};
- invalid = {
+ const invalid = {
pattern: /(\s|~|\^|:|\?|\*|\[|\\|\.\.|@\{|\/{2,}){1}/g,
prefix: "can't contain",
conjunction: ', ',
};
- single = {
+ const single = {
pattern: /^@+$/g,
prefix: "can't be",
conjunction: 'or',
@@ -51,19 +50,17 @@ export default class NewBranchForm {
}
validate() {
- var errorMessage, errors, formatter, unique, validator;
const { indexOf } = [];
this.branchNameError.empty();
- unique = function(values, value) {
+ const unique = function(values, value) {
if (indexOf.call(values, value) === -1) {
values.push(value);
}
return values;
};
- formatter = function(values, restriction) {
- var formatted;
- formatted = values.map(value => {
+ const formatter = function(values, restriction) {
+ const formatted = values.map(value => {
switch (false) {
case !/\s/.test(value):
return 'spaces';
@@ -75,10 +72,9 @@ export default class NewBranchForm {
});
return `${restriction.prefix} ${formatted.join(restriction.conjunction)}`;
};
- validator = (function(_this) {
+ const validator = (function(_this) {
return function(errors, restriction) {
- var matched;
- matched = _this.name.val().match(restriction.pattern);
+ const matched = _this.name.val().match(restriction.pattern);
if (matched) {
return errors.concat(formatter(matched.reduce(unique, []), restriction));
} else {
@@ -86,9 +82,9 @@ export default class NewBranchForm {
}
};
})(this);
- errors = this.restrictions.reduce(validator, []);
+ const errors = this.restrictions.reduce(validator, []);
if (errors.length > 0) {
- errorMessage = $('<span/>').text(errors.join(', '));
+ const errorMessage = $('<span/>').text(errors.join(', '));
return this.branchNameError.append(errorMessage);
}
}