Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
dd0ecc8e
Commit
dd0ecc8e
authored
Nov 15, 2019
by
Lee Tickett
Committed by
Kushal Pandya
Nov 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove var from new_branch_form.js
parent
d18625a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
app/assets/javascripts/new_branch_form.js
app/assets/javascripts/new_branch_form.js
+12
-16
changelogs/unreleased/remove_var_from_new_branch_Form_js.yml
changelogs/unreleased/remove_var_from_new_branch_Form_js.yml
+5
-0
No files found.
app/assets/javascripts/new_branch_form.js
View file @
dd0ecc8e
/* 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
);
}
}
...
...
changelogs/unreleased/remove_var_from_new_branch_Form_js.yml
0 → 100644
View file @
dd0ecc8e
---
title
:
Remove var from new_branch_form.js
merge_request
:
20099
author
:
Lee Tickett
type
:
other
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment