Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F118572624
PhamePostDeleteController.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, Jun 21, 00:48
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jun 23, 00:48 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
26889171
Attached To
rPH Phabricator
PhamePostDeleteController.php
View Options
<?php
final
class
PhamePostDeleteController
extends
PhameController
{
private
$id
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
id
=
$data
[
'id'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$post
=
id
(
new
PhamePostQuery
())
->
setViewer
(
$user
)
->
withIDs
(
array
(
$this
->
id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$post
)
{
return
new
Aphront404Response
();
}
if
(
$request
->
isFormPost
())
{
$post
->
delete
();
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
'/phame/post/'
);
}
$cancel_uri
=
$this
->
getApplicationURI
(
'/post/view/'
.
$post
->
getID
().
'/'
);
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$user
)
->
setTitle
(
pht
(
'Delete Post?'
))
->
appendChild
(
pht
(
'Really delete the post "%s"? It will be gone forever.'
,
$post
->
getTitle
()))
->
addSubmitButton
(
pht
(
'Delete'
))
->
addCancelButton
(
$cancel_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
Event Timeline
Log In to Comment