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
4377b479
Commit
4377b479
authored
Feb 01, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove useless ajaxPost method
parent
988747df
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
21 deletions
+6
-21
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+0
-3
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+6
-5
spec/javascripts/lib/utils/common_utils_spec.js
spec/javascripts/lib/utils/common_utils_spec.js
+0
-13
No files found.
app/assets/javascripts/lib/utils/common_utils.js
View file @
4377b479
...
@@ -35,8 +35,6 @@ export const ajaxGet = url => axios.get(url, {
...
@@ -35,8 +35,6 @@ export const ajaxGet = url => axios.get(url, {
$
.
globalEval
(
data
);
$
.
globalEval
(
data
);
});
});
export
const
ajaxPost
=
(
url
,
data
)
=>
axios
.
post
(
url
,
data
);
export
const
rstrip
=
(
val
)
=>
{
export
const
rstrip
=
(
val
)
=>
{
if
(
val
)
{
if
(
val
)
{
return
val
.
replace
(
/
\s
+$/
,
''
);
return
val
.
replace
(
/
\s
+$/
,
''
);
...
@@ -409,7 +407,6 @@ window.gl.utils = {
...
@@ -409,7 +407,6 @@ window.gl.utils = {
getGroupSlug
,
getGroupSlug
,
isInIssuePage
,
isInIssuePage
,
ajaxGet
,
ajaxGet
,
ajaxPost
,
rstrip
,
rstrip
,
updateTooltipTitle
,
updateTooltipTitle
,
disableButtonIfEmptyField
,
disableButtonIfEmptyField
,
...
...
app/assets/javascripts/notes.js
View file @
4377b479
...
@@ -17,13 +17,14 @@ import 'vendor/jquery.caret'; // required by jquery.atwho
...
@@ -17,13 +17,14 @@ import 'vendor/jquery.caret'; // required by jquery.atwho
import
'
vendor/jquery.atwho
'
;
import
'
vendor/jquery.atwho
'
;
import
AjaxCache
from
'
~/lib/utils/ajax_cache
'
;
import
AjaxCache
from
'
~/lib/utils/ajax_cache
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
Flash
from
'
./flash
'
;
import
Flash
from
'
./flash
'
;
import
CommentTypeToggle
from
'
./comment_type_toggle
'
;
import
CommentTypeToggle
from
'
./comment_type_toggle
'
;
import
GLForm
from
'
./gl_form
'
;
import
GLForm
from
'
./gl_form
'
;
import
loadAwardsHandler
from
'
./awards_handler
'
;
import
loadAwardsHandler
from
'
./awards_handler
'
;
import
Autosave
from
'
./autosave
'
;
import
Autosave
from
'
./autosave
'
;
import
TaskList
from
'
./task_list
'
;
import
TaskList
from
'
./task_list
'
;
import
{
ajaxPost
,
isInViewport
,
getPagePath
,
scrollToElement
,
isMetaKey
}
from
'
./lib/utils/common_utils
'
;
import
{
isInViewport
,
getPagePath
,
scrollToElement
,
isMetaKey
}
from
'
./lib/utils/common_utils
'
;
import
imageDiffHelper
from
'
./image_diff/helpers/index
'
;
import
imageDiffHelper
from
'
./image_diff/helpers/index
'
;
import
{
localTimeAgo
}
from
'
./lib/utils/datetime_utility
'
;
import
{
localTimeAgo
}
from
'
./lib/utils/datetime_utility
'
;
...
@@ -1404,7 +1405,7 @@ export default class Notes {
...
@@ -1404,7 +1405,7 @@ export default class Notes {
* 2) Identify comment type; a) Main thread b) Discussion thread c) Discussion resolve
* 2) Identify comment type; a) Main thread b) Discussion thread c) Discussion resolve
* 3) Build temporary placeholder element (using `createPlaceholderNote`)
* 3) Build temporary placeholder element (using `createPlaceholderNote`)
* 4) Show placeholder note on UI
* 4) Show placeholder note on UI
* 5) Perform network request to submit the note using `a
jaxP
ost`
* 5) Perform network request to submit the note using `a
xios.p
ost`
* a) If request is successfully completed
* a) If request is successfully completed
* 1. Remove placeholder element
* 1. Remove placeholder element
* 2. Show submitted Note element
* 2. Show submitted Note element
...
@@ -1486,7 +1487,7 @@ export default class Notes {
...
@@ -1486,7 +1487,7 @@ export default class Notes {
/* eslint-disable promise/catch-or-return */
/* eslint-disable promise/catch-or-return */
// Make request to submit comment on server
// Make request to submit comment on server
a
jaxP
ost
(
formAction
,
formData
)
a
xios
.
p
ost
(
formAction
,
formData
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
const
note
=
res
.
data
;
const
note
=
res
.
data
;
...
@@ -1601,7 +1602,7 @@ export default class Notes {
...
@@ -1601,7 +1602,7 @@ export default class Notes {
*
*
* 1) Get Form metadata
* 1) Get Form metadata
* 2) Update note element with new content
* 2) Update note element with new content
* 3) Perform network request to submit the updated note using `a
jaxP
ost`
* 3) Perform network request to submit the updated note using `a
xios.p
ost`
* a) If request is successfully completed
* a) If request is successfully completed
* 1. Show submitted Note element
* 1. Show submitted Note element
* b) If request failed
* b) If request failed
...
@@ -1632,7 +1633,7 @@ export default class Notes {
...
@@ -1632,7 +1633,7 @@ export default class Notes {
/* eslint-disable promise/catch-or-return */
/* eslint-disable promise/catch-or-return */
// Make request to update comment on server
// Make request to update comment on server
a
jaxP
ost
(
formAction
,
formData
)
a
xios
.
p
ost
(
formAction
,
formData
)
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
// Submission successful! render final note element
// Submission successful! render final note element
this
.
updateNote
(
data
,
$editingNote
);
this
.
updateNote
(
data
,
$editingNote
);
...
...
spec/javascripts/lib/utils/common_utils_spec.js
View file @
4377b479
...
@@ -459,19 +459,6 @@ describe('common_utils', () => {
...
@@ -459,19 +459,6 @@ describe('common_utils', () => {
});
});
});
});
describe
(
'
ajaxPost
'
,
()
=>
{
it
(
'
should perform `$.ajax` call and do `POST` request
'
,
()
=>
{
const
requestURL
=
'
/some/random/api
'
;
const
data
=
{
keyname
:
'
value
'
};
const
ajaxSpy
=
spyOn
(
axios
,
'
post
'
).
and
.
callFake
(()
=>
{});
commonUtils
.
ajaxPost
(
requestURL
,
data
);
expect
(
ajaxSpy
.
calls
.
allArgs
()[
0
][
0
]).
toEqual
(
requestURL
);
expect
(
ajaxSpy
.
calls
.
allArgs
()[
0
][
1
]).
toEqual
(
data
);
});
});
describe
(
'
spriteIcon
'
,
()
=>
{
describe
(
'
spriteIcon
'
,
()
=>
{
let
beforeGon
;
let
beforeGon
;
...
...
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