Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/view/reviewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export class ReviewManager extends Disposable {
* explicit user action from something like reloading on an existing PR branch.
*/
private justSwitchedToReviewMode: boolean = false;
/**
* The last pull request the user explicitly switched to via the switch method.
* Used to enter review mode for this PR regardless of its state (open/closed/merged).
*/
private _switchedToPullRequest?: PullRequestModel;

public get switchingToReviewMode(): boolean {
return this._switchingToReviewMode;
Expand Down Expand Up @@ -481,13 +486,16 @@ export class ReviewManager extends Disposable {

const useReviewConfiguration = getReviewMode();

if (pr.isClosed && !useReviewConfiguration.closed) {
// If this is the PR the user explicitly switched to, always use review mode regardless of state
const isSwitchedToPullRequest = this._switchedToPullRequest?.number === pr.number;

if (pr.isClosed && !useReviewConfiguration.closed && !isSwitchedToPullRequest) {
Logger.appendLine('This PR is closed', this.id);
await this.clear(true);
return;
}

if (pr.isMerged && !useReviewConfiguration.merged) {
if (pr.isMerged && !useReviewConfiguration.merged && !isSwitchedToPullRequest) {
Logger.appendLine('This PR is merged', this.id);
await this.clear(true);
return;
Expand Down Expand Up @@ -1090,6 +1098,7 @@ export class ReviewManager extends Disposable {
this.statusBarItem.command = undefined;
this.statusBarItem.show();
this.switchingToReviewMode = true;
this._switchedToPullRequest = pr;

try {
await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification }, async (progress) => {
Expand Down Expand Up @@ -1243,6 +1252,7 @@ export class ReviewManager extends Disposable {

this._prNumber = undefined;
this._folderRepoManager.activePullRequest = undefined;
this._switchedToPullRequest = undefined;

if (this._statusBarItem) {
this._statusBarItem.hide();
Expand Down