Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77225343
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
Tue, Aug 13, 05:26
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Aug 15, 05:26 (2 d)
Engine
blob
Format
Raw Data
Handle
19837175
Attached To
rPH Phabricator
ReleephBranchAccessController.php
View Options
<?php
final
class
ReleephBranchAccessController
extends
ReleephProjectController
{
private
$action
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
action
=
$data
[
'action'
];
parent
::
willProcessRequest
(
$data
);
}
public
function
processRequest
()
{
$branch
=
$this
->
getReleephBranch
();
$request
=
$this
->
getRequest
();
$done_uri
=
$branch
->
getURI
();
switch
(
$this
->
action
)
{
case
'close'
:
$is_active
=
false
;
$title_text
=
pht
(
'Close Branch'
);
$body_text
=
pht
(
'Really close the branch "%s"?'
,
$branch
->
getBasename
());
$button_text
=
pht
(
'Close Branch'
);
break
;
case
're-open'
:
$is_active
=
true
;
$title_text
=
pht
(
'Reopen Branch'
);
$body_text
=
pht
(
'Really reopen the branch "%s"?'
,
$branch
->
getBasename
());
$button_text
=
pht
(
'Reopen Branch'
);
break
;
default
:
throw
new
Exception
(
"Unknown action '{$this->action}'!"
);
break
;
}
if
(
$request
->
isDialogFormPost
())
{
id
(
new
ReleephBranchEditor
())
->
setActor
(
$request
->
getUser
())
->
setReleephBranch
(
$branch
)
->
changeBranchAccess
(
$is_active
?
1
:
0
);
return
id
(
new
AphrontReloadResponse
())->
setURI
(
$done_uri
);
}
$dialog
=
new
AphrontDialogView
();
$dialog
->
setUser
(
$request
->
getUser
())
->
setTitle
(
$title_text
)
->
appendChild
(
$body_text
)
->
addSubmitButton
(
$button_text
)
->
addCancelButton
(
$done_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
Event Timeline
Log In to Comment