Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97372124
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, Jan 4, 07:44
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Jan 6, 07:44 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23395067
Attached To
rPH Phabricator
ReleephBranchAccessController.php
View Options
<?php
final
class
ReleephBranchAccessController
extends
ReleephBranchController
{
private
$action
;
private
$branchID
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
action
=
$data
[
'action'
];
$this
->
branchID
=
$data
[
'branchID'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$branch
=
id
(
new
ReleephBranchQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$this
->
branchID
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$branch
)
{
return
new
Aphront404Response
();
}
$this
->
setBranch
(
$branch
);
$action
=
$this
->
action
;
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