@@ -44,6 +44,7 @@ import {
4444} from "./pullRequestDetail.logic" ;
4545import { PullRequestGlyph } from "./pullRequestIcons" ;
4646import type { PickableEnvironment } from "./pullRequestProjectAssignment.logic" ;
47+ import { PullRequestMaintainerEdits } from "./PullRequestMaintainerEdits" ;
4748import { PullRequestThreadLinks } from "./PullRequestThreadLinks" ;
4849import { useInlineActionConfirm } from "./useInlineActionConfirm" ;
4950
@@ -83,6 +84,8 @@ export function PullRequestActionsMenu({
8384 onSelectMergeMethod,
8485 showsDeleteBranch,
8586 environmentConnected,
87+ canWriteSourceControl,
88+ onMaintainerEditsSaved,
8689 confirmDeleteBranch,
8790 pendingAction,
8891 perform,
@@ -92,7 +95,16 @@ export function PullRequestActionsMenu({
9295 environmentId : EnvironmentId ;
9396 reference : PullRequestRef ;
9497 pullRequestKey : string ;
95- detail : Pick < PullRequestDetail , "url" | "state" | "isDraft" | "headBranch" > ;
98+ detail : Pick <
99+ PullRequestDetail ,
100+ | "url"
101+ | "state"
102+ | "isDraft"
103+ | "headBranch"
104+ | "capabilities"
105+ | "viewerPermissions"
106+ | "maintainerCanModify"
107+ > ;
96108 terminology : ChangeRequestTerminology ;
97109 linkThreadRef : ScopedThreadRef | null ;
98110 onThreadPickerOpenChange : ( open : boolean ) => void ;
@@ -123,6 +135,8 @@ export function PullRequestActionsMenu({
123135 onSelectMergeMethod : ( method : PullRequestMergeMethod ) => void ;
124136 showsDeleteBranch : boolean ;
125137 environmentConnected : boolean ;
138+ canWriteSourceControl : boolean ;
139+ onMaintainerEditsSaved : ( ) => void ;
126140 confirmDeleteBranch : ( ) => Promise < void > ;
127141 pendingAction : PullRequestAction | null ;
128142 perform : PerformPullRequestAction ;
@@ -132,6 +146,10 @@ export function PullRequestActionsMenu({
132146 const keybindings = useAtomValue ( primaryServerKeybindingsAtom ) ;
133147 const inlineConfirm = useInlineActionConfirm ( pullRequestKey ) ;
134148 const actionPending = pendingAction !== null ;
149+ const showsMaintainerEdits =
150+ detail . capabilities . edit ?. maintainerEdits === true &&
151+ detail . viewerPermissions . maintainerEdits === true &&
152+ detail . maintainerCanModify !== undefined ;
135153 return (
136154 < Menu >
137155 < Tooltip >
@@ -164,7 +182,7 @@ export function PullRequestActionsMenu({
164182 : `More ${ terminology . singular } actions` }
165183 </ TooltipPopup >
166184 </ Tooltip >
167- < MenuPopup align = "end" side = "bottom" >
185+ < MenuPopup align = "end" side = "bottom" keepMounted = { showsMaintainerEdits } >
168186 < PullRequestThreadLinks
169187 display = "menu-item"
170188 environmentId = { environmentId }
@@ -218,6 +236,19 @@ export function PullRequestActionsMenu({
218236 />
219237 ) : null }
220238 < MenuSeparator />
239+ { showsMaintainerEdits && detail . maintainerCanModify !== undefined ? (
240+ < >
241+ < PullRequestMaintainerEdits
242+ key = { `${ detail . url } :${ detail . maintainerCanModify } ` }
243+ environmentId = { environmentId }
244+ reference = { reference }
245+ enabled = { detail . maintainerCanModify }
246+ allowed = { canWriteSourceControl && environmentConnected }
247+ onSaved = { onMaintainerEditsSaved }
248+ />
249+ < MenuSeparator />
250+ </ >
251+ ) : null }
221252 { detail . state === "open" ? (
222253 < >
223254 { showsDraftToggle ? (
0 commit comments