fix(web): reconcile main's round-5 features after the rebase
- PullRequestDetailPanel takes main's #6039 rework wholesale (reactions, update-branch, auto-merge, in-place editing); the thread-details action hooks stay in usePullRequestActions with label maps extended for the new action variants - CommandPalette #6330 provider subtitles adapted to the v2 shell (session -> runtime for provider instance and display name) Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
d0b6cbdec8
commit
1a1bb645bb
4 files changed
+37
-6
No files matched your search
@@ -161,7 +161,7 @@ export type BuildThreadActionItemsThread = Pick<
|
||||
| "id"
|
||||
| "modelSelection"
|
||||
| "projectId"
|
||||
| "session"
|
||||
| "runtime"
|
||||
| "title"
|
||||
| "worktreePath"
|
||||
> & {
|
||||
|
||||
@@ -1022,7 +1022,7 @@ function OpenCommandPaletteDialog(props: {
|
||||
renderTrailingContent: (thread) => <ThreadRowTrailingStatus thread={thread} />,
|
||||
renderDescription: (thread, { projectTitle }) => {
|
||||
const modelInstanceId =
|
||||
thread.session?.providerInstanceId ?? thread.modelSelection.instanceId;
|
||||
thread.runtime?.providerInstanceId ?? thread.modelSelection.instanceId;
|
||||
const providerEntry =
|
||||
providerEntryByEnvironmentAndInstanceId.get(
|
||||
`${thread.environmentId}:${modelInstanceId}`,
|
||||
@@ -1038,7 +1038,7 @@ function OpenCommandPaletteDialog(props: {
|
||||
isCurrent={thread.id === activeThreadId}
|
||||
driverKind={providerEntry?.driverKind ?? null}
|
||||
providerDisplayName={
|
||||
thread.session?.providerName ?? providerEntry?.displayName ?? modelInstanceId
|
||||
thread.runtime?.providerName ?? providerEntry?.displayName ?? modelInstanceId
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -47,7 +47,10 @@ import {
|
||||
useState,
|
||||
} from "react";
|
||||
|
||||
import { type DraftId, useComposerDraftStore } from "~/composerDraftStore";
|
||||
import { useNewThreadHandler } from "~/hooks/useHandleNewThread";
|
||||
import { useCopyToClipboard, writeTextToClipboard } from "~/hooks/useCopyToClipboard";
|
||||
import { usePreparePullRequestThreadAction } from "~/lib/sourceControlActions";
|
||||
import { cn } from "~/lib/utils";
|
||||
import { readLocalApi } from "~/localApi";
|
||||
import type { ReviewCommentContext } from "~/reviewCommentContext";
|
||||
@@ -91,7 +94,6 @@ import { openOnHostLabel, showPullRequestLinkContextMenu } from "./pullRequestLi
|
||||
import { PullRequestSummaryTab } from "./PullRequestSummaryTab";
|
||||
import { PullRequestTimelineTab } from "./PullRequestTimelineTab";
|
||||
import {
|
||||
allowedPullRequestMergeMethods,
|
||||
buildAskAboutLinesHandoff,
|
||||
buildAskAboutPullRequestHandoff,
|
||||
buildExplainPullRequestHandoff,
|
||||
@@ -1011,8 +1013,26 @@ export function PullRequestDetailPanel({
|
||||
useEffect(() => {
|
||||
if (!visibleTabs.some((item) => item.value === tab)) setTab("summary");
|
||||
}, [tab, visibleTabs]);
|
||||
const can = (action: PullRequestAction) => canPerformPullRequestAction(detail, action);
|
||||
const primaryAction = resolvePullRequestPrimaryAction(detail);
|
||||
// Two questions, both of which have to say yes: whether this host can do it at all, and
|
||||
// whether this account may. A reader with read access on someone else's project sees the pull
|
||||
// request and none of the buttons that would only ever be refused.
|
||||
const can = (action: PullRequestAction) =>
|
||||
detail?.capabilities.actions.includes(action) === true &&
|
||||
detail.viewerPermissions.actions.includes(action);
|
||||
// One live action holds the slot. A conflicting change cannot be merged now, so the slot goes
|
||||
// to the thing that would help instead of a Merge button that only ever says no.
|
||||
const primaryAction =
|
||||
detail === null || detail.state !== "open"
|
||||
? null
|
||||
: detail.isDraft && can("ready")
|
||||
? "ready"
|
||||
: !can("merge")
|
||||
? null
|
||||
: conflicting
|
||||
? "resolve"
|
||||
: allowedMergeMethods.length > 0
|
||||
? "merge"
|
||||
: null;
|
||||
// The pull request number carries this state in the overview and the right-panel tab mirrors
|
||||
// it. Conflicts keep their own row below: an open pull request remains green there.
|
||||
const statePresentation = detail
|
||||
|
||||
@@ -31,6 +31,9 @@ const ACTION_SUCCESS_LABELS: Record<PullRequestAction, string> = {
|
||||
draft: "Converted to draft",
|
||||
close: "Pull request closed",
|
||||
reopen: "Pull request reopened",
|
||||
"update-branch": "Branch updated with the base branch",
|
||||
"enable-auto-merge": "Auto-merge enabled",
|
||||
"disable-auto-merge": "Auto-merge disabled",
|
||||
};
|
||||
|
||||
/** Said as the thing that did not happen, rather than as the operation that returned an error. */
|
||||
@@ -40,6 +43,9 @@ const ACTION_FAILURE_LABELS: Record<PullRequestAction, string> = {
|
||||
draft: "Could not convert this to a draft",
|
||||
close: "Could not close this pull request",
|
||||
reopen: "Could not reopen this pull request",
|
||||
"update-branch": "Could not update this branch",
|
||||
"enable-auto-merge": "Could not enable auto-merge",
|
||||
"disable-auto-merge": "Could not disable auto-merge",
|
||||
};
|
||||
|
||||
/** What to try, for the times the host says only that it refused. */
|
||||
@@ -51,6 +57,11 @@ const ACTION_FAILURE_HINTS: Record<PullRequestAction, string> = {
|
||||
close: "The host refused it. Check that you have write access, or that you opened it.",
|
||||
reopen:
|
||||
"The host refused it. Check that you have write access, and that the branch still exists.",
|
||||
"update-branch":
|
||||
"The host refused it. Check that you have write access, and that the base branch has not diverged in a way the host cannot merge.",
|
||||
"enable-auto-merge":
|
||||
"The host refused it. Check that auto-merge is enabled for this repository and that you have write access.",
|
||||
"disable-auto-merge": "The host refused it. Check that you have write access to this repository.",
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user