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
d6fdda1d
Commit
d6fdda1d
authored
May 22, 2020
by
jakeburden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create methods to update issues and MRs in api.js
parent
5c28738d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
+56
-0
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+17
-0
changelogs/unreleased/191455-add-a-button-to-quickly-assign-users-who-have-commented-on-an-issu.yml
...to-quickly-assign-users-who-have-commented-on-an-issu.yml
+5
-0
spec/frontend/api_spec.js
spec/frontend/api_spec.js
+34
-0
No files found.
app/assets/javascripts/api.js
View file @
d6fdda1d
...
...
@@ -51,6 +51,7 @@ const Api = {
pipelinesPath
:
'
/api/:version/projects/:id/pipelines/
'
,
environmentsPath
:
'
/api/:version/projects/:id/environments
'
,
rawFilePath
:
'
/api/:version/projects/:id/repository/files/:path/raw
'
,
issuePath
:
'
/api/:version/projects/:id/issues/:issue_iid
'
,
group
(
groupId
,
callback
)
{
const
url
=
Api
.
buildUrl
(
Api
.
groupPath
).
replace
(
'
:id
'
,
groupId
);
...
...
@@ -540,6 +541,22 @@ const Api = {
return
axios
.
get
(
url
,
{
params
});
},
updateIssue
(
project
,
issue
,
data
=
{})
{
const
url
=
Api
.
buildUrl
(
Api
.
issuePath
)
.
replace
(
'
:id
'
,
encodeURIComponent
(
project
))
.
replace
(
'
:issue_iid
'
,
encodeURIComponent
(
issue
));
return
axios
.
put
(
url
,
data
);
},
updateMergeRequest
(
project
,
mergeRequest
,
data
=
{})
{
const
url
=
Api
.
buildUrl
(
Api
.
projectMergeRequestPath
)
.
replace
(
'
:id
'
,
encodeURIComponent
(
project
))
.
replace
(
'
:mrid
'
,
encodeURIComponent
(
mergeRequest
));
return
axios
.
put
(
url
,
data
);
},
buildUrl
(
url
)
{
return
joinPaths
(
gon
.
relative_url_root
||
''
,
url
.
replace
(
'
:version
'
,
gon
.
api_version
));
},
...
...
changelogs/unreleased/191455-add-a-button-to-quickly-assign-users-who-have-commented-on-an-issu.yml
0 → 100644
View file @
d6fdda1d
---
title
:
Add api.js methods to update issues and merge requests
merge_request
:
32893
author
:
type
:
added
spec/frontend/api_spec.js
View file @
d6fdda1d
...
...
@@ -691,4 +691,38 @@ describe('Api', () => {
});
});
});
describe
(
'
updateIssue
'
,
()
=>
{
it
(
'
update an issue with the given payload
'
,
done
=>
{
const
projectId
=
8
;
const
issue
=
1
;
const
expectedArray
=
[
1
,
2
,
3
];
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectId
}
/issues/
${
issue
}
`
;
mock
.
onPut
(
expectedUrl
).
reply
(
200
,
{
assigneeIds
:
expectedArray
});
Api
.
updateIssue
(
projectId
,
issue
,
{
assigneeIds
:
expectedArray
})
.
then
(({
data
})
=>
{
expect
(
data
.
assigneeIds
).
toEqual
(
expectedArray
);
done
();
})
.
catch
(
done
.
fail
);
});
});
describe
(
'
updateMergeRequest
'
,
()
=>
{
it
(
'
update an issue with the given payload
'
,
done
=>
{
const
projectId
=
8
;
const
mergeRequest
=
1
;
const
expectedArray
=
[
1
,
2
,
3
];
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectId
}
/merge_requests/
${
mergeRequest
}
`
;
mock
.
onPut
(
expectedUrl
).
reply
(
200
,
{
assigneeIds
:
expectedArray
});
Api
.
updateMergeRequest
(
projectId
,
mergeRequest
,
{
assigneeIds
:
expectedArray
})
.
then
(({
data
})
=>
{
expect
(
data
.
assigneeIds
).
toEqual
(
expectedArray
);
done
();
})
.
catch
(
done
.
fail
);
});
});
});
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