Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96192355
DiffusionRepositoryEditActivateController.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, Dec 23, 15:12
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 25, 15:12 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23134316
Attached To
rPH Phabricator
DiffusionRepositoryEditActivateController.php
View Options
<?php
final
class
DiffusionRepositoryEditActivateController
extends
DiffusionRepositoryEditController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$drequest
=
$this
->
diffusionRequest
;
$repository
=
$drequest
->
getRepository
();
$repository
=
id
(
new
PhabricatorRepositoryQuery
())
->
setViewer
(
$viewer
)
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
withIDs
(
array
(
$repository
->
getID
()))
->
executeOne
();
if
(!
$repository
)
{
return
new
Aphront404Response
();
}
$edit_uri
=
$this
->
getRepositoryControllerURI
(
$repository
,
'edit/'
);
if
(
$request
->
isFormPost
())
{
$xaction
=
id
(
new
PhabricatorRepositoryTransaction
())
->
setTransactionType
(
PhabricatorRepositoryTransaction
::
TYPE_ACTIVATE
)
->
setNewValue
(!
$repository
->
isTracked
());
$editor
=
id
(
new
PhabricatorRepositoryEditor
())
->
setContinueOnNoEffect
(
true
)
->
setContentSourceFromRequest
(
$request
)
->
setActor
(
$viewer
)
->
applyTransactions
(
$repository
,
array
(
$xaction
));
return
id
(
new
AphrontReloadResponse
())->
setURI
(
$edit_uri
);
}
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$viewer
);
if
(
$repository
->
isTracked
())
{
$dialog
->
setTitle
(
pht
(
'Deactivate Repository?'
))
->
appendChild
(
pht
(
'Deactivate this repository?'
))
->
addSubmitButton
(
pht
(
'Deactivate Repository'
))
->
addCancelButton
(
$edit_uri
);
}
else
{
$dialog
->
setTitle
(
pht
(
'Activate Repository?'
))
->
appendChild
(
pht
(
'Activate this repository?'
))
->
addSubmitButton
(
pht
(
'Activate Repository'
))
->
addCancelButton
(
$edit_uri
);
}
return
id
(
new
AphrontDialogResponse
())
->
setDialog
(
$dialog
);
}
}
Event Timeline
Log In to Comment