Skip to content

Commit 4e25332

Browse files
committed
fix: address PR review feedback
- Update openChat comment (no longer called from /openChat route). - Use this.view?.show() instead of executeCommand for focus. - Add icon to coderChat view entry in package.json. - Pass allowedOrigin instead of '*' in postMessage to iframe.
1 parent 59f1aad commit 4e25332

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@
236236
{
237237
"type": "webview",
238238
"id": "coder.chatPanel",
239-
"name": "Coder Chat"
239+
"name": "Coder Chat",
240+
"icon": "media/shorthand-logo.svg"
240241
}
241242
]
242243
},

src/webviews/chat/chatPanelProvider.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { randomBytes } from "node:crypto";
2-
import * as vscode from "vscode";
32

43
import { type CoderApi } from "../../api/coderApi";
54
import { type Logger } from "../../logging/logger";
65

6+
import type * as vscode from "vscode";
7+
78
/**
89
* Provides a webview that embeds the Coder agent chat UI.
910
* Authentication flows through postMessage:
@@ -33,12 +34,14 @@ export class ChatPanelProvider
3334
) {}
3435

3536
/**
36-
* Called by the `/openChat` URI handler.
37+
* Opens the chat panel for the given chat ID.
38+
* Called after a deep link reload via the persisted
39+
* pendingChatId, or directly for testing.
3740
*/
3841
public openChat(chatId: string): void {
3942
this.chatId = chatId;
4043
this.refresh();
41-
void vscode.commands.executeCommand("coder.chatPanel.focus");
44+
this.view?.show(true);
4245
}
4346

4447
resolveWebviewView(
@@ -167,7 +170,7 @@ export class ChatPanelProvider
167170
iframe.contentWindow.postMessage({
168171
type: 'coder:vscode-auth-bootstrap',
169172
payload: { token: data.token },
170-
}, '*');
173+
}, '${allowedOrigin}');
171174
}
172175
});
173176
})();

0 commit comments

Comments
 (0)