Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93826758
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
Sun, Dec 1, 20:03
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 3, 20:03 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22711045
Attached To
rPH Phabricator
ReleephBranchAccessController.php
View Options
<?php
final
class
ReleephBranchAccessController
extends
ReleephController
{
private
$action
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
action
=
$data
[
'action'
];
parent
::
willProcessRequest
(
$data
);
}
public
function
processRequest
()
{
$rph_branch
=
$this
->
getReleephBranch
();
$request
=
$this
->
getRequest
();
$active_uri
=
'/releeph/project/'
.
$rph_branch
->
getReleephProjectID
().
'/'
;
$inactive_uri
=
$active_uri
.
'inactive/'
;
switch
(
$this
->
action
)
{
case
'close'
:
$is_active
=
false
;
$origin_uri
=
$active_uri
;
break
;
case
're-open'
:
$is_active
=
true
;
$origin_uri
=
$inactive_uri
;
break
;
default
:
throw
new
Exception
(
"Unknown action '{$this->action}'!"
);
break
;
}
if
(
$request
->
isDialogFormPost
())
{
id
(
new
ReleephBranchEditor
())
->
setActor
(
$request
->
getUser
())
->
setReleephBranch
(
$rph_branch
)
->
changeBranchAccess
(
$is_active
?
1
:
0
);
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
$origin_uri
);
}
$button_text
=
ucfirst
(
$this
->
action
).
' Branch'
;
$message
=
hsprintf
(
'<p>Really %s the branch <i>%s</i>?</p>'
,
$this
->
action
,
$rph_branch
->
getBasename
());
$dialog
=
new
AphrontDialogView
();
$dialog
->
setUser
(
$request
->
getUser
())
->
setTitle
(
'Confirm'
)
->
appendChild
(
$message
)
->
addSubmitButton
(
$button_text
)
->
addCancelButton
(
$origin_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
Event Timeline
Log In to Comment