Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2339487
PhabricatorAuthContactNumberPrimaryController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorAuthContactNumberPrimaryController.php
View Options
<?php
final
class
PhabricatorAuthContactNumberPrimaryController
extends
PhabricatorAuthContactNumberController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$number
=
id
(
new
PhabricatorAuthContactNumberQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$number
)
{
return
new
Aphront404Response
();
}
$id
=
$number
->
getID
();
$cancel_uri
=
$number
->
getURI
();
if
(
$number
->
isDisabled
())
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Number Disabled'
))
->
appendParagraph
(
pht
(
'You can not make a disabled number your primary contact number.'
))
->
addCancelButton
(
$cancel_uri
);
}
if
(
$number
->
getIsPrimary
())
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Number Already Primary'
))
->
appendParagraph
(
pht
(
'This contact number is already your primary contact number.'
))
->
addCancelButton
(
$cancel_uri
);
}
if
(
$request
->
isFormPost
())
{
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhabricatorAuthContactNumberTransaction
())
->
setTransactionType
(
PhabricatorAuthContactNumberPrimaryTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
true
);
$editor
=
id
(
new
PhabricatorAuthContactNumberEditor
())
->
setActor
(
$viewer
)
->
setContentSourceFromRequest
(
$request
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
);
$editor
->
applyTransactions
(
$number
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$cancel_uri
);
}
$number_display
=
phutil_tag
(
'strong'
,
array
(),
$number
->
getDisplayName
());
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Set Primary Contact Number'
))
->
appendParagraph
(
pht
(
'Designate %s as your primary contact number?'
,
$number_display
))
->
addSubmitButton
(
pht
(
'Make Primary'
))
->
addCancelButton
(
$cancel_uri
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 9:14 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
445909
Default Alt Text
PhabricatorAuthContactNumberPrimaryController.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment