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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
7256626d
Commit
7256626d
authored
Aug 04, 2017
by
Mike Greiling
Committed by
Clement Ho
Aug 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove monkey-patched Array.prototype.first() and last() methods
parent
fe5086c2
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
11 additions
and
52 deletions
+11
-52
app/assets/javascripts/ajax_loading_spinner.js
app/assets/javascripts/ajax_loading_spinner.js
+1
-1
app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js
...ets/javascripts/cycle_analytics/cycle_analytics_bundle.js
+1
-1
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+1
-1
app/assets/javascripts/dropzone_input.js
app/assets/javascripts/dropzone_input.js
+1
-1
app/assets/javascripts/extensions/array.js
app/assets/javascripts/extensions/array.js
+0
-11
app/assets/javascripts/filtered_search/dropdown_utils.js
app/assets/javascripts/filtered_search/dropdown_utils.js
+2
-2
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
...ripts/filtered_search/filtered_search_dropdown_manager.js
+1
-1
app/assets/javascripts/filtered_search/filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+1
-1
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-3
spec/javascripts/abuse_reports_spec.js
spec/javascripts/abuse_reports_spec.js
+3
-3
spec/javascripts/ajax_loading_spinner_spec.js
spec/javascripts/ajax_loading_spinner_spec.js
+0
-1
spec/javascripts/extensions/array_spec.js
spec/javascripts/extensions/array_spec.js
+0
-22
spec/javascripts/filtered_search/dropdown_utils_spec.js
spec/javascripts/filtered_search/dropdown_utils_spec.js
+0
-1
spec/javascripts/filtered_search/filtered_search_dropdown_manager_spec.js
.../filtered_search/filtered_search_dropdown_manager_spec.js
+0
-1
spec/javascripts/filtered_search/filtered_search_token_keys_spec.js
...cripts/filtered_search/filtered_search_token_keys_spec.js
+0
-1
spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js
...scripts/filtered_search/filtered_search_tokenizer_spec.js
+0
-1
No files found.
app/assets/javascripts/ajax_loading_spinner.js
View file @
7256626d
...
@@ -10,7 +10,7 @@ class AjaxLoadingSpinner {
...
@@ -10,7 +10,7 @@ class AjaxLoadingSpinner {
e
.
target
.
setAttribute
(
'
disabled
'
,
''
);
e
.
target
.
setAttribute
(
'
disabled
'
,
''
);
const
iconElement
=
e
.
target
.
querySelector
(
'
i
'
);
const
iconElement
=
e
.
target
.
querySelector
(
'
i
'
);
// get first fa- icon
// get first fa- icon
const
originalIcon
=
iconElement
.
className
.
match
(
/
(
fa-
)([^\s]
+
)
/g
)
.
first
()
;
const
originalIcon
=
iconElement
.
className
.
match
(
/
(
fa-
)([^\s]
+
)
/g
)
[
0
]
;
iconElement
.
dataset
.
icon
=
originalIcon
;
iconElement
.
dataset
.
icon
=
originalIcon
;
AjaxLoadingSpinner
.
toggleLoadingIcon
(
iconElement
);
AjaxLoadingSpinner
.
toggleLoadingIcon
(
iconElement
);
$
(
e
.
target
).
off
(
'
ajax:beforeSend
'
,
AjaxLoadingSpinner
.
ajaxBeforeSend
);
$
(
e
.
target
).
off
(
'
ajax:beforeSend
'
,
AjaxLoadingSpinner
.
ajaxBeforeSend
);
...
...
app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js
View file @
7256626d
...
@@ -92,7 +92,7 @@ $(() => {
...
@@ -92,7 +92,7 @@ $(() => {
});
});
},
},
selectDefaultStage
()
{
selectDefaultStage
()
{
const
stage
=
this
.
state
.
stages
.
first
()
;
const
stage
=
this
.
state
.
stages
[
0
]
;
this
.
selectStage
(
stage
);
this
.
selectStage
(
stage
);
},
},
selectStage
(
stage
)
{
selectStage
(
stage
)
{
...
...
app/assets/javascripts/dispatcher.js
View file @
7256626d
...
@@ -504,7 +504,7 @@ import GpgBadges from './gpg_badges';
...
@@ -504,7 +504,7 @@ import GpgBadges from './gpg_badges';
new
gl
.
DueDateSelectors
();
new
gl
.
DueDateSelectors
();
break
;
break
;
}
}
switch
(
path
.
first
()
)
{
switch
(
path
[
0
]
)
{
case
'
sessions
'
:
case
'
sessions
'
:
case
'
omniauth_callbacks
'
:
case
'
omniauth_callbacks
'
:
if
(
!
gon
.
u2f
)
break
;
if
(
!
gon
.
u2f
)
break
;
...
...
app/assets/javascripts/dropzone_input.js
View file @
7256626d
...
@@ -217,7 +217,7 @@ window.DropzoneInput = (function() {
...
@@ -217,7 +217,7 @@ window.DropzoneInput = (function() {
value
=
e
.
clipboardData
.
getData
(
'
text/plain
'
);
value
=
e
.
clipboardData
.
getData
(
'
text/plain
'
);
}
}
value
=
value
.
split
(
"
\r
"
);
value
=
value
.
split
(
"
\r
"
);
return
value
.
first
()
;
return
value
[
0
]
;
};
};
const
showSpinner
=
function
(
e
)
{
const
showSpinner
=
function
(
e
)
{
...
...
app/assets/javascripts/extensions/array.js
deleted
100644 → 0
View file @
fe5086c2
// TODO: remove this
// eslint-disable-next-line no-extend-native
Array
.
prototype
.
first
=
function
first
()
{
return
this
[
0
];
};
// eslint-disable-next-line no-extend-native
Array
.
prototype
.
last
=
function
last
()
{
return
this
[
this
.
length
-
1
];
};
app/assets/javascripts/filtered_search/dropdown_utils.js
View file @
7256626d
...
@@ -123,11 +123,11 @@ class DropdownUtils {
...
@@ -123,11 +123,11 @@ class DropdownUtils {
if
(
!
allowMultiple
&&
itemInExistingTokens
)
{
if
(
!
allowMultiple
&&
itemInExistingTokens
)
{
updatedItem
.
droplab_hidden
=
true
;
updatedItem
.
droplab_hidden
=
true
;
}
else
if
(
!
lastKey
||
searchInput
.
split
(
''
).
last
(
)
===
'
'
)
{
}
else
if
(
!
lastKey
||
_
.
last
(
searchInput
.
split
(
''
)
)
===
'
'
)
{
updatedItem
.
droplab_hidden
=
false
;
updatedItem
.
droplab_hidden
=
false
;
}
else
if
(
lastKey
)
{
}
else
if
(
lastKey
)
{
const
split
=
lastKey
.
split
(
'
:
'
);
const
split
=
lastKey
.
split
(
'
:
'
);
const
tokenName
=
split
[
0
].
split
(
'
'
).
last
(
);
const
tokenName
=
_
.
last
(
split
[
0
].
split
(
'
'
)
);
const
match
=
updatedItem
.
hint
.
indexOf
(
tokenName
.
toLowerCase
())
===
-
1
;
const
match
=
updatedItem
.
hint
.
indexOf
(
tokenName
.
toLowerCase
())
===
-
1
;
updatedItem
.
droplab_hidden
=
tokenName
?
match
:
false
;
updatedItem
.
droplab_hidden
=
tokenName
?
match
:
false
;
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js
View file @
7256626d
...
@@ -167,7 +167,7 @@ class FilteredSearchDropdownManager {
...
@@ -167,7 +167,7 @@ class FilteredSearchDropdownManager {
// Eg. token = 'label:'
// Eg. token = 'label:'
const
split
=
lastToken
.
split
(
'
:
'
);
const
split
=
lastToken
.
split
(
'
:
'
);
const
dropdownName
=
split
[
0
].
split
(
'
'
).
last
(
);
const
dropdownName
=
_
.
last
(
split
[
0
].
split
(
'
'
)
);
this
.
loadDropdown
(
split
.
length
>
1
?
dropdownName
:
''
);
this
.
loadDropdown
(
split
.
length
>
1
?
dropdownName
:
''
);
}
else
if
(
lastToken
)
{
}
else
if
(
lastToken
)
{
// Token has been initialized into an object because it has a value
// Token has been initialized into an object because it has a value
...
...
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
7256626d
...
@@ -367,7 +367,7 @@ class FilteredSearchManager {
...
@@ -367,7 +367,7 @@ class FilteredSearchManager {
const
fragments
=
searchToken
.
split
(
'
:
'
);
const
fragments
=
searchToken
.
split
(
'
:
'
);
if
(
fragments
.
length
>
1
)
{
if
(
fragments
.
length
>
1
)
{
const
inputValues
=
fragments
[
0
].
split
(
'
'
);
const
inputValues
=
fragments
[
0
].
split
(
'
'
);
const
tokenKey
=
inputValues
.
last
(
);
const
tokenKey
=
_
.
last
(
inputValues
);
if
(
inputValues
.
length
>
1
)
{
if
(
inputValues
.
length
>
1
)
{
inputValues
.
pop
();
inputValues
.
pop
();
...
...
app/assets/javascripts/main.js
View file @
7256626d
...
@@ -16,9 +16,6 @@ import 'mousetrap';
...
@@ -16,9 +16,6 @@ import 'mousetrap';
import
'
mousetrap/plugins/pause/mousetrap-pause
'
;
import
'
mousetrap/plugins/pause/mousetrap-pause
'
;
import
'
vendor/fuzzaldrin-plus
'
;
import
'
vendor/fuzzaldrin-plus
'
;
// extensions
import
'
./extensions/array
'
;
// expose common libraries as globals (TODO: remove these)
// expose common libraries as globals (TODO: remove these)
window
.
jQuery
=
jQuery
;
window
.
jQuery
=
jQuery
;
window
.
$
=
jQuery
;
window
.
$
=
jQuery
;
...
...
spec/javascripts/abuse_reports_spec.js
View file @
7256626d
...
@@ -6,10 +6,10 @@ import '~/abuse_reports';
...
@@ -6,10 +6,10 @@ import '~/abuse_reports';
const
FIXTURE
=
'
abuse_reports/abuse_reports_list.html.raw
'
;
const
FIXTURE
=
'
abuse_reports/abuse_reports_list.html.raw
'
;
const
MAX_MESSAGE_LENGTH
=
500
;
const
MAX_MESSAGE_LENGTH
=
500
;
let
messages
;
let
$
messages
;
const
assertMaxLength
=
$message
=>
expect
(
$message
.
text
().
length
).
toEqual
(
MAX_MESSAGE_LENGTH
);
const
assertMaxLength
=
$message
=>
expect
(
$message
.
text
().
length
).
toEqual
(
MAX_MESSAGE_LENGTH
);
const
findMessage
=
searchText
=>
messages
.
filter
(
const
findMessage
=
searchText
=>
$
messages
.
filter
(
(
index
,
element
)
=>
element
.
innerText
.
indexOf
(
searchText
)
>
-
1
,
(
index
,
element
)
=>
element
.
innerText
.
indexOf
(
searchText
)
>
-
1
,
).
first
();
).
first
();
...
@@ -18,7 +18,7 @@ import '~/abuse_reports';
...
@@ -18,7 +18,7 @@ import '~/abuse_reports';
beforeEach
(
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
FIXTURE
);
loadFixtures
(
FIXTURE
);
this
.
abuseReports
=
new
global
.
AbuseReports
();
this
.
abuseReports
=
new
global
.
AbuseReports
();
messages
=
$
(
'
.abuse-reports .message
'
);
$
messages
=
$
(
'
.abuse-reports .message
'
);
});
});
it
(
'
should truncate long messages
'
,
()
=>
{
it
(
'
should truncate long messages
'
,
()
=>
{
...
...
spec/javascripts/ajax_loading_spinner_spec.js
View file @
7256626d
import
'
~/extensions/array
'
;
import
'
jquery
'
;
import
'
jquery
'
;
import
'
jquery-ujs
'
;
import
'
jquery-ujs
'
;
import
'
~/ajax_loading_spinner
'
;
import
'
~/ajax_loading_spinner
'
;
...
...
spec/javascripts/extensions/array_spec.js
deleted
100644 → 0
View file @
fe5086c2
/* eslint-disable space-before-function-paren, no-var */
import
'
~/extensions/array
'
;
(
function
()
{
describe
(
'
Array extensions
'
,
function
()
{
describe
(
'
first
'
,
function
()
{
return
it
(
'
returns the first item
'
,
function
()
{
var
arr
;
arr
=
[
0
,
1
,
2
,
3
,
4
,
5
];
return
expect
(
arr
.
first
()).
toBe
(
0
);
});
});
describe
(
'
last
'
,
function
()
{
return
it
(
'
returns the last item
'
,
function
()
{
var
arr
;
arr
=
[
0
,
1
,
2
,
3
,
4
,
5
];
return
expect
(
arr
.
last
()).
toBe
(
5
);
});
});
});
}).
call
(
window
);
spec/javascripts/filtered_search/dropdown_utils_spec.js
View file @
7256626d
import
'
~/extensions/array
'
;
import
'
~/filtered_search/dropdown_utils
'
;
import
'
~/filtered_search/dropdown_utils
'
;
import
'
~/filtered_search/filtered_search_tokenizer
'
;
import
'
~/filtered_search/filtered_search_tokenizer
'
;
import
'
~/filtered_search/filtered_search_dropdown_manager
'
;
import
'
~/filtered_search/filtered_search_dropdown_manager
'
;
...
...
spec/javascripts/filtered_search/filtered_search_dropdown_manager_spec.js
View file @
7256626d
import
'
~/extensions/array
'
;
import
'
~/filtered_search/filtered_search_visual_tokens
'
;
import
'
~/filtered_search/filtered_search_visual_tokens
'
;
import
'
~/filtered_search/filtered_search_tokenizer
'
;
import
'
~/filtered_search/filtered_search_tokenizer
'
;
import
'
~/filtered_search/filtered_search_dropdown_manager
'
;
import
'
~/filtered_search/filtered_search_dropdown_manager
'
;
...
...
spec/javascripts/filtered_search/filtered_search_token_keys_spec.js
View file @
7256626d
import
'
~/extensions/array
'
;
import
'
~/filtered_search/filtered_search_token_keys
'
;
import
'
~/filtered_search/filtered_search_token_keys
'
;
describe
(
'
Filtered Search Token Keys
'
,
()
=>
{
describe
(
'
Filtered Search Token Keys
'
,
()
=>
{
...
...
spec/javascripts/filtered_search/filtered_search_tokenizer_spec.js
View file @
7256626d
import
'
~/extensions/array
'
;
import
'
~/filtered_search/filtered_search_token_keys
'
;
import
'
~/filtered_search/filtered_search_token_keys
'
;
import
'
~/filtered_search/filtered_search_tokenizer
'
;
import
'
~/filtered_search/filtered_search_tokenizer
'
;
...
...
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