提交 642a28d0 编写于 作者: T Tomas Vik

Merge branch 'namespace-the-mr-commenting' into 'main'

fix: limit commenting only to GitLab MRs

See merge request gitlab-org/gitlab-vscode-extension!276
......@@ -279,40 +279,43 @@
{
"command": "gl.startEditingComment",
"group": "inline@1",
"when": "comment =~ /canAdmin/"
"when": "commentController =~ /^gitlab-mr-/ && comment =~ /canAdmin/"
},
{
"command": "gl.deleteComment",
"group": "inline@2",
"when": "comment =~ /canAdmin/"
"when": "commentController =~ /^gitlab-mr-/ && comment =~ /canAdmin/"
}
],
"comments/comment/context": [
{
"command": "gl.submitCommentEdit",
"group": "inline@1"
"group": "inline@1",
"when": "commentController =~ /^gitlab-mr-/"
},
{
"command": "gl.cancelEditingComment",
"group": "inline@2"
"group": "inline@2",
"when": "commentController =~ /^gitlab-mr-/"
}
],
"comments/commentThread/title": [
{
"command": "gl.resolveThread",
"group": "inline@1",
"when": "commentThread == unresolved"
"when": "commentController =~ /^gitlab-mr-/ && commentThread == unresolved"
},
{
"command": "gl.unresolveThread",
"group": "inline@2",
"when": "commentThread == resolved"
"when": "commentController =~ /^gitlab-mr-/ && commentThread == resolved"
}
],
"comments/commentThread/context": [
{
"command": "gl.createComment",
"group": "inline"
"group": "inline",
"when": "commentController =~ /^gitlab-mr-/"
}
]
},
......
......@@ -46,7 +46,10 @@ describe('MrItemModel', () => {
it('should add comment thread to VS Code', async () => {
await item.getChildren();
expect(createCommentControllerMock).toBeCalledWith('gitlab-org/gitlab!2000', 'Issuable Title');
expect(createCommentControllerMock).toBeCalledWith(
'gitlab-mr-gitlab-org/gitlab!2000',
'Issuable Title',
);
const [uri, range] = createCommentThreadMock.mock.calls[0];
expect(uri.path).toBe('src/webview/src/components/LabelNoteOld.vue');
expect(range.start.line).toBe(47);
......
......@@ -61,7 +61,7 @@ export class MrItemModel extends ItemModel {
private async initializeMrDiscussions(mrVersion: RestMrVersion): Promise<void> {
const commentController = vscode.comments.createCommentController(
this.mr.references.full,
`gitlab-mr-${this.mr.references.full}`,
this.mr.title,
);
this.setDisposableChildren([commentController]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册