Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F555126
HarbormasterBuildActionController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
HarbormasterBuildActionController.php
View Options
<?php
final
class
HarbormasterBuildActionController
extends
HarbormasterController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$action
=
$request
->
getURIData
(
'action'
);
$via
=
$request
->
getURIData
(
'via'
);
$build
=
id
(
new
HarbormasterBuildQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$build
)
{
return
new
Aphront404Response
();
}
$xaction
=
HarbormasterBuildMessageTransaction
::
getTransactionObjectForMessageType
(
$action
);
if
(!
$xaction
)
{
return
new
Aphront404Response
();
}
switch
(
$via
)
{
case
'buildable'
:
$return_uri
=
'/'
.
$build
->
getBuildable
()->
getMonogram
();
break
;
default
:
$return_uri
=
$this
->
getApplicationURI
(
'/build/'
.
$build
->
getID
().
'/'
);
break
;
}
try
{
$xaction
->
assertCanSendMessage
(
$viewer
,
$build
);
}
catch
(
HarbormasterMessageException
$ex
)
{
return
$this
->
newDialog
()
->
setTitle
(
$ex
->
getTitle
())
->
appendChild
(
$ex
->
getBody
())
->
addCancelButton
(
$return_uri
);
}
if
(
$request
->
isDialogFormPost
())
{
$build
->
sendMessage
(
$viewer
,
$xaction
->
getHarbormasterBuildMessageType
());
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$return_uri
);
}
$title
=
$xaction
->
newConfirmPromptTitle
();
$body
=
$xaction
->
newConfirmPromptBody
();
$submit
=
$xaction
->
getHarbormasterBuildMessageName
();
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendChild
(
$body
)
->
addCancelButton
(
$return_uri
)
->
addSubmitButton
(
$submit
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 6:24 PM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
111484
Default Alt Text
HarbormasterBuildActionController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment