Skip to content

Commit f535424

Browse files
committed
Revert "Move command registrations from pullRequestOverview.ts to commands.ts"
This reverts commit c01c824.
1 parent c01c824 commit f535424

2 files changed

Lines changed: 23 additions & 20 deletions

File tree

src/commands.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { ChatSessionWithPR, CrossChatSessionWithPR } from './github/copilotApi';
2222
import { CopilotRemoteAgentManager } from './github/copilotRemoteAgent';
2323
import { FolderRepositoryManager } from './github/folderRepositoryManager';
2424
import { GitHubRepository } from './github/githubRepository';
25-
import { Issue, MergeMethod } from './github/interface';
25+
import { Issue } from './github/interface';
2626
import { IssueModel } from './github/issueModel';
2727
import { IssueOverviewPanel } from './github/issueOverview';
2828
import { GHPRComment, GHPRCommentThread, TemporaryComment } from './github/prComment';
@@ -815,14 +815,6 @@ export function registerCommands(
815815

816816
context.subscriptions.push(
817817
vscode.commands.registerCommand('pr.readyForReview', async (pr?: PRNode) => {
818-
// When called from webview context menu (no PRNode), trigger the webview action
819-
if (!pr && PullRequestOverviewPanel.currentPanel) {
820-
PullRequestOverviewPanel.currentPanel['_postMessage']({
821-
command: 'pr.readyForReview-trigger'
822-
});
823-
return;
824-
}
825-
826818
const folderManager = reposManager.getManagerForIssueModel(pr?.pullRequestModel);
827819
if (!folderManager) {
828820
return;
@@ -852,17 +844,6 @@ export function registerCommands(
852844
}),
853845
);
854846

855-
context.subscriptions.push(
856-
vscode.commands.registerCommand('pr.readyForReviewAndMerge', async (_context?: { mergeMethod: MergeMethod }) => {
857-
// This command is only called from webview context menu
858-
if (PullRequestOverviewPanel.currentPanel) {
859-
PullRequestOverviewPanel.currentPanel['_postMessage']({
860-
command: 'pr.readyForReviewAndMerge-trigger'
861-
});
862-
}
863-
}),
864-
);
865-
866847
context.subscriptions.push(
867848
vscode.commands.registerCommand('pr.dismissNotification', node => {
868849
if (node instanceof PRNode) {

src/github/pullRequestOverview.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
142142

143143
this.setVisibilityContext();
144144

145+
this._register(vscode.commands.registerCommand('pr.readyForReview', async () => {
146+
return this.readyForReviewCommand();
147+
}));
148+
this._register(vscode.commands.registerCommand('pr.readyForReviewAndMerge', async (context?: { mergeMethod: MergeMethod }) => {
149+
return this.readyForReviewAndMergeCommand(context);
150+
}));
145151
this._register(vscode.commands.registerCommand('review.approveDescription', (e) => this.approvePullRequestCommand(e)));
146152
this._register(vscode.commands.registerCommand('review.commentDescription', (e) => this.submitReviewCommand(e)));
147153
this._register(vscode.commands.registerCommand('review.requestChangesDescription', (e) => this.requestChangesCommand(e)));
@@ -678,6 +684,22 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
678684
}
679685
}
680686

687+
private async readyForReviewCommand(): Promise<void> {
688+
// Trigger the webview action by posting a message
689+
// This will use the existing webview logic which handles busy state
690+
this._postMessage({
691+
command: 'pr.readyForReview-trigger'
692+
});
693+
}
694+
695+
private async readyForReviewAndMergeCommand(_context?: { mergeMethod: MergeMethod }): Promise<void> {
696+
// Trigger the webview action by posting a message
697+
// This will use the existing webview logic which handles busy state
698+
this._postMessage({
699+
command: 'pr.readyForReviewAndMerge-trigger'
700+
});
701+
}
702+
681703
private async checkoutDefaultBranch(message: IRequestMessage<string>): Promise<void> {
682704
try {
683705
const prBranch = this._folderRepositoryManager.repository.state.HEAD?.name;

0 commit comments

Comments
 (0)