Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F118696592
ReleephBranchAccessController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jun 21, 16:56
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jun 23, 16:56 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
26917478
Attached To
rPH Phabricator
ReleephBranchAccessController.php
View Options
<?php
final
class
ReleephBranchAccessController
extends
ReleephBranchController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$action
=
$request
->
getURIData
(
'action'
);
$id
=
$request
->
getURIData
(
'branchID'
);
$branch
=
id
(
new
ReleephBranchQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$branch
)
{
return
new
Aphront404Response
();
}
$this
->
setBranch
(
$branch
);
switch
(
$action
)
{
case
'close'
:
case
're-open'
:
break
;
default
:
return
new
Aphront404Response
();
}
$branch_uri
=
$this
->
getBranchViewURI
(
$branch
);
if
(
$request
->
isFormPost
())
{
if
(
$action
==
're-open'
)
{
$is_active
=
1
;
}
else
{
$is_active
=
0
;
}
id
(
new
ReleephBranchEditor
())
->
setActor
(
$request
->
getUser
())
->
setReleephBranch
(
$branch
)
->
changeBranchAccess
(
$is_active
);
return
id
(
new
AphrontReloadResponse
())->
setURI
(
$branch_uri
);
}
if
(
$action
==
'close'
)
{
$title_text
=
pht
(
'Really Close Branch?'
);
$short
=
pht
(
'Close Branch'
);
$body_text
=
pht
(
'Really close the branch "%s"?'
,
phutil_tag
(
'strong'
,
array
(),
$branch
->
getBasename
()));
$button_text
=
pht
(
'Close Branch'
);
}
else
{
$title_text
=
pht
(
'Really Reopen Branch?'
);
$short
=
pht
(
'Reopen Branch'
);
$body_text
=
pht
(
'Really reopen the branch "%s"?'
,
phutil_tag
(
'strong'
,
array
(),
$branch
->
getBasename
()));
$button_text
=
pht
(
'Reopen Branch'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title_text
)
->
setShortTitle
(
$short
)
->
appendChild
(
$body_text
)
->
addSubmitButton
(
$button_text
)
->
addCancelButton
(
$branch_uri
);
}
}
Event Timeline
Log In to Comment