fix(gitlab): remove absolute gitlab.com api endpoints

This commit is contained in:
Rhys Arkins 2018-06-15 07:20:48 +02:00
parent b163bc3266
commit 67c7d9a6cf
2 changed files with 10 additions and 12 deletions

View file

@ -382,9 +382,9 @@ function addReviewers(iid, reviewers) {
}
async function getComments(issueNo) {
// GET https://gitlab.com/api/v4/projects/:owner/:repo/merge_requests/:number/notes
// GET /api/v4/projects/:owner/:repo/merge_requests/:number/notes
logger.debug(`Getting comments for #${issueNo}`);
const url = `https://gitlab.com/api/v4/projects/${
const url = `/api/v4/projects/${
config.repository
}/merge_requests/${issueNo}/notes`;
const comments = (await get(url, { paginate: true })).body;
@ -393,11 +393,9 @@ async function getComments(issueNo) {
}
async function addComment(issueNo, body) {
// POST https://gitlab.com/api/v4/projects/:owner/:repo/merge_requests/:number/notes
// POST /api/v4/projects/:owner/:repo/merge_requests/:number/notes
await get.post(
`https://gitlab.com/api/v4/projects/${
config.repository
}/merge_requests/${issueNo}/notes`,
`/api/v4/projects/${config.repository}/merge_requests/${issueNo}/notes`,
{
body: { body },
}
@ -405,9 +403,9 @@ async function addComment(issueNo, body) {
}
async function editComment(issueNo, commentId, body) {
// PATCH https://gitlab.com/api/v4/projects/:owner/:repo/merge_requests/:number/notes/:id
// PATCH /api/v4/projects/:owner/:repo/merge_requests/:number/notes/:id
await get.patch(
`https://gitlab.com/api/v4/projects/${
`/api/v4/projects/${
config.repository
}/merge_requests/${issueNo}/notes/${commentId}`,
{
@ -417,9 +415,9 @@ async function editComment(issueNo, commentId, body) {
}
async function deleteComment(issueNo, commentId) {
// DELETE https://gitlab.com/api/v4/projects/:owner/:repo/merge_requests/:number/notes/:id
// DELETE /api/v4/projects/:owner/:repo/merge_requests/:number/notes/:id
await get.delete(
`https://gitlab.com/api/v4/projects/${
`/api/v4/projects/${
config.repository
}/merge_requests/${issueNo}/notes/${commentId}`
);

View file

@ -127,7 +127,7 @@ Array [
exports[`platform/gitlab ensureComment add comment if not found 1`] = `
Array [
Array [
"https://gitlab.com/api/v4/projects/some%2Frepo/merge_requests/42/notes",
"/api/v4/projects/some%2Frepo/merge_requests/42/notes",
Object {
"body": Object {
"body": "### some-subject
@ -143,7 +143,7 @@ content",
exports[`platform/gitlab ensureComment add updates comment if necessary 1`] = `
Array [
Array [
"https://gitlab.com/api/v4/projects/some%2Frepo/merge_requests/42/notes/1234",
"/api/v4/projects/some%2Frepo/merge_requests/42/notes/1234",
Object {
"body": Object {
"body": "### some-subject