Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93240826
ReleephRequestViewController.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
Wed, Nov 27, 07:05
Size
2 KB
Mime Type
text/x-php
Expires
Fri, Nov 29, 07:05 (2 d)
Engine
blob
Format
Raw Data
Handle
22601656
Attached To
rPH Phabricator
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
);
$timeline
=
$this
->
buildTransactionTimeline
(
$pull
,
new
ReleephRequestTransactionQuery
());
$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
,
));
}
}
Event Timeline
Log In to Comment