Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2358650
ReleephRequestViewController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ReleephRequestViewController.php
View Options
<?php
final
class
ReleephRequestViewController
extends
ReleephBranchController
{
private
$requestID
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
requestID
=
$data
[
'requestID'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$pull
=
id
(
new
ReleephRequestQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$this
->
requestID
))
->
executeOne
();
if
(!
$pull
)
{
return
new
Aphront404Response
();
}
$this
->
setBranch
(
$pull
->
getBranch
());
// Redirect older URIs to new "Y" URIs.
// TODO: Get rid of this eventually.
$actual_path
=
$request
->
getRequestURI
()->
getPath
();
$expect_path
=
'/'
.
$pull
->
getMonogram
();
if
(
$actual_path
!=
$expect_path
)
{
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$expect_path
);
}
// TODO: Break this 1:1 stuff?
$branch
=
$pull
->
getBranch
();
$field_list
=
PhabricatorCustomField
::
getObjectFields
(
$pull
,
PhabricatorCustomField
::
ROLE_VIEW
);
$field_list
->
setViewer
(
$viewer
)
->
readFieldsFromStorage
(
$pull
);
// TODO: This should be more modern and general.
$engine
=
id
(
new
PhabricatorMarkupEngine
())
->
setViewer
(
$viewer
);
foreach
(
$field_list
->
getFields
()
as
$field
)
{
if
(
$field
->
shouldMarkup
())
{
$field
->
setMarkupEngine
(
$engine
);
}
}
$engine
->
process
();
$pull_box
=
id
(
new
ReleephRequestView
())
->
setUser
(
$viewer
)
->
setCustomFields
(
$field_list
)
->
setPullRequest
(
$pull
);
$xactions
=
id
(
new
ReleephRequestTransactionQuery
())
->
setViewer
(
$viewer
)
->
withObjectPHIDs
(
array
(
$pull
->
getPHID
()))
->
execute
();
$timeline
=
id
(
new
PhabricatorApplicationTransactionView
())
->
setUser
(
$request
->
getUser
())
->
setObjectPHID
(
$pull
->
getPHID
())
->
setTransactions
(
$xactions
);
$add_comment_header
=
pht
(
'Plea or Yield'
);
$draft
=
PhabricatorDraft
::
newFromUserAndKey
(
$viewer
,
$pull
->
getPHID
());
$title
=
hsprintf
(
"%s %s"
,
$pull
->
getMonogram
(),
$pull
->
getSummaryForDisplay
());
$add_comment_form
=
id
(
new
PhabricatorApplicationTransactionCommentView
())
->
setUser
(
$viewer
)
->
setObjectPHID
(
$pull
->
getPHID
())
->
setDraft
(
$draft
)
->
setHeaderText
(
$add_comment_header
)
->
setAction
(
$this
->
getApplicationURI
(
'/request/comment/'
.
$pull
->
getID
().
'/'
))
->
setSubmitButtonName
(
pht
(
'Comment'
));
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
$pull
->
getMonogram
(),
'/'
.
$pull
->
getMonogram
());
return
$this
->
buildStandardPageResponse
(
array
(
$crumbs
,
$pull_box
,
$timeline
,
$add_comment_form
,
),
array
(
'title'
=>
$title
,
'device'
=>
true
,
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 3:03 PM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
443576
Default Alt Text
ReleephRequestViewController.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment