Loading src/desktop/issuable_controller.ts +10 −0 Original line number Diff line number Diff line Loading @@ -93,7 +93,17 @@ class IssuableController implements RepositoryRootWebviewProvider { if (message.command === 'saveNote') { try { const gitlabService = getGitLabService(projectInRepository); try { await gitlabService.createNote(issuable, message.note, message.replyId); } catch (error) { // See https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/357 const isCommentOnlyError = String( error?.details?.errorMessage?.startsWith('Commands only'), ); if (!isCommentOnlyError) { throw error; } } const discussionsAndLabels = await gitlabService.getDiscussionsAndLabelEvents(issuable); await panel.webview.postMessage({ type: 'issuableFetch', Loading test/integration/issuable_webview.test.js +18 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,14 @@ describe('GitLab Issuable webview', () => { }, }, }); if (issuableId === 'gid://gitlab/Issue/35284557' && body === '/assign @testuser') return HttpResponse.json({ data: { createNote: { errors: ['Commands only Added @testuser as assignee'], }, }, }); return new HttpResponse(null, { status: 500 }); }), createJsonEndpoint( Loading Loading @@ -68,6 +76,16 @@ describe('GitLab Issuable webview', () => { assert.strictEqual(sentMessage.status, undefined); }); it('sends a message for slash-commands', async () => { webviewMock.postMessage({ command: 'saveNote', note: '/assign @testuser', }); const sentMessage = await webviewMock.waitForMessage(m => m.type === 'noteSaved'); assert.strictEqual(sentMessage.type, 'noteSaved'); assert.strictEqual(sentMessage.status, undefined); }); it('adds the correct panel icon', () => { const { dark, light } = webviewMock.webview.iconPath; assert.match(dark.path, /src\/assets\/images\/dark\/issues.svg$/); Loading Loading
src/desktop/issuable_controller.ts +10 −0 Original line number Diff line number Diff line Loading @@ -93,7 +93,17 @@ class IssuableController implements RepositoryRootWebviewProvider { if (message.command === 'saveNote') { try { const gitlabService = getGitLabService(projectInRepository); try { await gitlabService.createNote(issuable, message.note, message.replyId); } catch (error) { // See https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/357 const isCommentOnlyError = String( error?.details?.errorMessage?.startsWith('Commands only'), ); if (!isCommentOnlyError) { throw error; } } const discussionsAndLabels = await gitlabService.getDiscussionsAndLabelEvents(issuable); await panel.webview.postMessage({ type: 'issuableFetch', Loading
test/integration/issuable_webview.test.js +18 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,14 @@ describe('GitLab Issuable webview', () => { }, }, }); if (issuableId === 'gid://gitlab/Issue/35284557' && body === '/assign @testuser') return HttpResponse.json({ data: { createNote: { errors: ['Commands only Added @testuser as assignee'], }, }, }); return new HttpResponse(null, { status: 500 }); }), createJsonEndpoint( Loading Loading @@ -68,6 +76,16 @@ describe('GitLab Issuable webview', () => { assert.strictEqual(sentMessage.status, undefined); }); it('sends a message for slash-commands', async () => { webviewMock.postMessage({ command: 'saveNote', note: '/assign @testuser', }); const sentMessage = await webviewMock.waitForMessage(m => m.type === 'noteSaved'); assert.strictEqual(sentMessage.type, 'noteSaved'); assert.strictEqual(sentMessage.status, undefined); }); it('adds the correct panel icon', () => { const { dark, light } = webviewMock.webview.iconPath; assert.match(dark.path, /src\/assets\/images\/dark\/issues.svg$/); Loading