Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121612357
PholioMockCommentController.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
Sat, Jul 12, 11:07
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jul 14, 11:07 (2 d)
Engine
blob
Format
Raw Data
Handle
27358540
Attached To
rPH Phabricator
PholioMockCommentController.php
View Options
<?php
/**
* @group pholio
*/
final
class
PholioMockCommentController
extends
PholioController
{
private
$id
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
id
=
$data
[
'id'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$mock
=
id
(
new
PholioMockQuery
())
->
setViewer
(
$user
)
->
withIDs
(
array
(
$this
->
id
))
->
executeOne
();
if
(!
$mock
)
{
return
new
Aphront404Response
();
}
$mock_uri
=
'/M'
.
$mock
->
getID
();
$comment
=
$request
->
getStr
(
'comment'
);
if
(!
strlen
(
$comment
))
{
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$user
)
->
setTitle
(
pht
(
'Empty Comment'
))
->
appendChild
(
'You did not provide a comment!'
)
->
addCancelButton
(
$mock_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
$content_source
=
PhabricatorContentSource
::
newForSource
(
PhabricatorContentSource
::
SOURCE_WEB
,
array
(
'ip'
=>
$request
->
getRemoteAddr
(),
));
$xaction
=
id
(
new
PholioTransaction
())
->
setTransactionType
(
PholioTransactionType
::
TYPE_NONE
)
->
setComment
(
$comment
);
id
(
new
PholioMockEditor
())
->
setActor
(
$user
)
->
setContentSource
(
$content_source
)
->
applyTransactions
(
$mock
,
array
(
$xaction
));
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$mock_uri
);
}
}
Event Timeline
Log In to Comment