Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F118053411
PhabricatorAuthContactNumberPrimaryTransaction.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
Tue, Jun 17, 09:50
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jun 19, 09:50 (2 d)
Engine
blob
Format
Raw Data
Handle
26838401
Attached To
rPH Phabricator
PhabricatorAuthContactNumberPrimaryTransaction.php
View Options
<?php
final
class
PhabricatorAuthContactNumberPrimaryTransaction
extends
PhabricatorAuthContactNumberTransactionType
{
const
TRANSACTIONTYPE
=
'primary'
;
public
function
generateOldValue
(
$object
)
{
return
(
bool
)
$object
->
getIsPrimary
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setIsPrimary
((
int
)
$value
);
}
public
function
getTitle
()
{
return
pht
(
'%s made this the primary contact number.'
,
$this
->
renderAuthor
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
foreach
(
$xactions
as
$xaction
)
{
$new_value
=
$xaction
->
getNewValue
();
if
(!
$new_value
)
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'To choose a different primary contact number, make that '
.
'number primary (instead of trying to demote this one).'
),
$xaction
);
continue
;
}
if
(
$object
->
isDisabled
())
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'You can not make a disabled number a primary contact number.'
),
$xaction
);
continue
;
}
$mfa_error
=
$this
->
newContactNumberMFAError
(
$object
,
$xaction
);
if
(
$mfa_error
)
{
$errors
[]
=
$mfa_error
;
continue
;
}
}
return
$errors
;
}
}
Event Timeline
Log In to Comment