Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99989442
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
Mon, Jan 27, 14:58
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Jan 29, 14:58 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23863872
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