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) { 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}`); logger.debug(`Getting comments for #${issueNo}`);
const url = `https://gitlab.com/api/v4/projects/${ const url = `/api/v4/projects/${
config.repository config.repository
}/merge_requests/${issueNo}/notes`; }/merge_requests/${issueNo}/notes`;
const comments = (await get(url, { paginate: true })).body; const comments = (await get(url, { paginate: true })).body;
@ -393,11 +393,9 @@ async function getComments(issueNo) {
} }
async function addComment(issueNo, body) { 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( await get.post(
`https://gitlab.com/api/v4/projects/${ `/api/v4/projects/${config.repository}/merge_requests/${issueNo}/notes`,
config.repository
}/merge_requests/${issueNo}/notes`,
{ {
body: { body }, body: { body },
} }
@ -405,9 +403,9 @@ async function addComment(issueNo, body) {
} }
async function editComment(issueNo, commentId, 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( await get.patch(
`https://gitlab.com/api/v4/projects/${ `/api/v4/projects/${
config.repository config.repository
}/merge_requests/${issueNo}/notes/${commentId}`, }/merge_requests/${issueNo}/notes/${commentId}`,
{ {
@ -417,9 +415,9 @@ async function editComment(issueNo, commentId, body) {
} }
async function deleteComment(issueNo, commentId) { 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( await get.delete(
`https://gitlab.com/api/v4/projects/${ `/api/v4/projects/${
config.repository config.repository
}/merge_requests/${issueNo}/notes/${commentId}` }/merge_requests/${issueNo}/notes/${commentId}`
); );

View file

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