Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104879104
PhamePostUnpublishController.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
Thu, Mar 13, 02:18
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Mar 15, 02:18 (1 d, 17 h)
Engine
blob
Format
Raw Data
Handle
24872227
Attached To
rPH Phabricator
PhamePostUnpublishController.php
View Options
<?php
final
class
PhamePostUnpublishController
extends
PhamePostController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$post
=
id
(
new
PhamePostQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$post
)
{
return
new
Aphront404Response
();
}
if
(
$request
->
isFormPost
())
{
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhamePostTransaction
())
->
setTransactionType
(
PhamePostTransaction
::
TYPE_TITLE
)
->
setNewValue
(
$post
->
getTitle
());
$xactions
[]
=
id
(
new
PhamePostTransaction
())
->
setTransactionType
(
PhamePostTransaction
::
TYPE_PHAME_TITLE
)
->
setNewValue
(
$post
->
getPhameTitle
());
$xactions
[]
=
id
(
new
PhamePostTransaction
())
->
setTransactionType
(
PhamePostTransaction
::
TYPE_VISIBILITY
)
->
setNewValue
(
PhameConstants
::
VISIBILITY_DRAFT
);
id
(
new
PhamePostEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$post
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
$this
->
getApplicationURI
(
'/post/view/'
.
$post
->
getID
().
'/'
));
}
$cancel_uri
=
$this
->
getApplicationURI
(
'/post/view/'
.
$post
->
getID
().
'/'
);
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$viewer
)
->
setTitle
(
pht
(
'Unpublish Post?'
))
->
appendChild
(
pht
(
'The post "%s" will no longer be visible to other users until you '
.
'republish it.'
,
$post
->
getTitle
()))
->
addSubmitButton
(
pht
(
'Unpublish'
))
->
addCancelButton
(
$cancel_uri
);
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
Event Timeline
Log In to Comment