Add changes to match ee
This commit is contained in:
parent
7b5cc7b47e
commit
016c79cad7
3 changed files with 18 additions and 16 deletions
|
@ -49,7 +49,7 @@ export default {
|
||||||
required: false,
|
required: false,
|
||||||
default: () => ({
|
default: () => ({
|
||||||
sourceProjectId: '',
|
sourceProjectId: '',
|
||||||
issueId: '',
|
mergeRequestId: '',
|
||||||
appUrl: '',
|
appUrl: '',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default {
|
||||||
visualReviewAppMeta() {
|
visualReviewAppMeta() {
|
||||||
return {
|
return {
|
||||||
appUrl: this.mr.appUrl,
|
appUrl: this.mr.appUrl,
|
||||||
issueId: this.mr.iid,
|
mergeRequestId: this.mr.iid,
|
||||||
sourceProjectId: this.mr.sourceProjectId,
|
sourceProjectId: this.mr.sourceProjectId,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -374,12 +374,12 @@ function clearNote (inputId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirmAndClear (discussionId) {
|
function confirmAndClear (mergeRequestId) {
|
||||||
const commentButton = document.getElementById('gitlab-comment-button');
|
const commentButton = document.getElementById('gitlab-comment-button');
|
||||||
const note = document.getElementById('gitlab-validation-note');
|
const note = document.getElementById('gitlab-validation-note');
|
||||||
|
|
||||||
commentButton.innerText = 'Feedback sent';
|
commentButton.innerText = 'Feedback sent';
|
||||||
note.innerText = `Your comment was successfully posted to issue #${discussionId}`;
|
note.innerText = `Your comment was successfully posted to merge request #${mergeRequestId}`;
|
||||||
|
|
||||||
setTimeout(resetCommentButton, 1000);
|
setTimeout(resetCommentButton, 1000);
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ function getProjectDetails () {
|
||||||
const browser = getBrowserId(userAgent);
|
const browser = getBrowserId(userAgent);
|
||||||
|
|
||||||
const scriptEl = document.getElementById('review-app-toolbar-script')
|
const scriptEl = document.getElementById('review-app-toolbar-script')
|
||||||
const { projectId, discussionId, mrUrl } = scriptEl.dataset;
|
const { projectId, mergeRequestId, mrUrl } = scriptEl.dataset;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
href,
|
href,
|
||||||
|
@ -422,7 +422,7 @@ function getProjectDetails () {
|
||||||
innerWidth,
|
innerWidth,
|
||||||
innerHeight,
|
innerHeight,
|
||||||
projectId,
|
projectId,
|
||||||
discussionId,
|
mergeRequestId,
|
||||||
mrUrl,
|
mrUrl,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ function postComment ({
|
||||||
innerWidth,
|
innerWidth,
|
||||||
innerHeight,
|
innerHeight,
|
||||||
projectId,
|
projectId,
|
||||||
discussionId,
|
mergeRequestId,
|
||||||
mrUrl,
|
mrUrl,
|
||||||
}) {
|
}) {
|
||||||
// Clear any old errors
|
// Clear any old errors
|
||||||
|
@ -466,16 +466,18 @@ function postComment ({
|
||||||
}
|
}
|
||||||
|
|
||||||
const detailText = `
|
const detailText = `
|
||||||
|
\n
|
||||||
<details>
|
<details>
|
||||||
<summary>Metadata</summary>
|
<summary>Metadata</summary>
|
||||||
Posted from ${href} | ${platform} | ${browser} | ${innerWidth} x ${innerHeight}.
|
Posted from ${href} | ${platform} | ${browser} | ${innerWidth} x ${innerHeight}.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
*User agent: ${userAgent}*
|
<em>User agent: ${userAgent}</em>
|
||||||
</details>
|
</details>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const url = `
|
const url = `
|
||||||
${mrUrl}/api/v4/projects/${projectId}/issues/${discussionId}/discussions`;
|
${mrUrl}/api/v4/projects/${projectId}/merge_requests/${mergeRequestId}/discussions`;
|
||||||
|
|
||||||
|
|
||||||
const body = `${commentText} ${detailText}`;
|
const body = `${commentText} ${detailText}`;
|
||||||
|
|
||||||
|
@ -489,7 +491,7 @@ function postComment ({
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
confirmAndClear(discussionId);
|
confirmAndClear(mergeRequestId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue