Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99505517
ManiphestSubscribeController.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, Jan 25, 01:52
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jan 27, 01:52 (2 d)
Engine
blob
Format
Raw Data
Handle
23814183
Attached To
rPH Phabricator
ManiphestSubscribeController.php
View Options
<?php
final
class
ManiphestSubscribeController
extends
ManiphestController
{
private
$id
;
private
$action
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
id
=
$data
[
'id'
];
$this
->
action
=
$data
[
'action'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$task
=
id
(
new
ManiphestTaskQuery
())
->
setViewer
(
$user
)
->
withIDs
(
array
(
$this
->
id
))
->
executeOne
();
if
(!
$task
)
{
return
new
Aphront404Response
();
}
$ccs
=
$task
->
getCCPHIDs
();
switch
(
$this
->
action
)
{
case
'add'
:
$ccs
[]
=
$user
->
getPHID
();
break
;
case
'rem'
:
$ccs
=
array_diff
(
$ccs
,
array
(
$user
->
getPHID
()));
break
;
default
:
return
new
Aphront400Response
();
}
$xaction
=
id
(
new
ManiphestTransaction
())
->
setTransactionType
(
ManiphestTransaction
::
TYPE_CCS
)
->
setNewValue
(
$ccs
);
$editor
=
id
(
new
ManiphestTransactionEditor
())
->
setActor
(
$user
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$task
,
array
(
$xaction
));
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
'/T'
.
$task
->
getID
());
}
}
Event Timeline
Log In to Comment