Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97988475
PhabricatorProjectLockController.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
Wed, Jan 8, 08:08
Size
2 KB
Mime Type
text/x-php
Expires
Fri, Jan 10, 08:08 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23473075
Attached To
rPH Phabricator
PhabricatorProjectLockController.php
View Options
<?php
final
class
PhabricatorProjectLockController
extends
PhabricatorProjectController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$this
->
requireApplicationCapability
(
ProjectCanLockProjectsCapability
::
CAPABILITY
);
$id
=
$request
->
getURIData
(
'id'
);
$project
=
id
(
new
PhabricatorProjectQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$project
)
{
return
new
Aphront404Response
();
}
$done_uri
=
$project
->
getURI
();
$is_locked
=
$project
->
getIsMembershipLocked
();
if
(
$request
->
isFormPost
())
{
$xactions
=
array
();
if
(
$is_locked
)
{
$new_value
=
0
;
}
else
{
$new_value
=
1
;
}
$xactions
[]
=
id
(
new
PhabricatorProjectTransaction
())
->
setTransactionType
(
PhabricatorProjectTransaction
::
TYPE_LOCKED
)
->
setNewValue
(
$new_value
);
$editor
=
id
(
new
PhabricatorProjectTransactionEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
applyTransactions
(
$project
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$done_uri
);
}
if
(
$project
->
getIsMembershipLocked
())
{
$title
=
pht
(
'Unlock Project'
);
$body
=
pht
(
'If you unlock this project, members will be free to leave.'
);
$button
=
pht
(
'Unlock Project'
);
}
else
{
$title
=
pht
(
'Lock Project'
);
$body
=
pht
(
'If you lock this project, members will be prevented from '
.
'leaving it.'
);
$button
=
pht
(
'Lock Project'
);
}
return
$this
->
newDialog
()
->
setTitle
(
$title
)
->
appendParagraph
(
$body
)
->
addSubmitbutton
(
$button
)
->
addCancelButton
(
$done_uri
);
}
}
Event Timeline
Log In to Comment