Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F429473
PonderQuestionStatusController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PonderQuestionStatusController.php
View Options
<?php
final
class
PonderQuestionStatusController
extends
PonderController
{
private
$status
;
private
$id
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
status
=
idx
(
$data
,
'status'
);
$this
->
id
=
idx
(
$data
,
'id'
);
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$question
=
id
(
new
PonderQuestionQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$this
->
id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$question
)
{
return
new
Aphront404Response
();
}
switch
(
$this
->
status
)
{
case
'open'
:
$status
=
PonderQuestionStatus
::
STATUS_OPEN
;
break
;
case
'close'
:
$status
=
PonderQuestionStatus
::
STATUS_CLOSED
;
break
;
default
:
return
new
Aphront400Response
();
}
$xactions
=
array
();
$xactions
[]
=
id
(
new
PonderQuestionTransaction
())
->
setTransactionType
(
PonderQuestionTransaction
::
TYPE_STATUS
)
->
setNewValue
(
$status
);
$editor
=
id
(
new
PonderQuestionEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
);
$editor
->
applyTransactions
(
$question
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
'/Q'
.
$question
->
getID
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 8:34 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
59717
Default Alt Text
PonderQuestionStatusController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment