Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F437148
PhabricatorAuthContactNumberStatusTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorAuthContactNumberStatusTransaction.php
View Options
<?php
final
class
PhabricatorAuthContactNumberStatusTransaction
extends
PhabricatorAuthContactNumberTransactionType
{
const
TRANSACTIONTYPE
=
'status'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getStatus
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setStatus
(
$value
);
}
public
function
getTitle
()
{
$new
=
$this
->
getNewValue
();
if
(
$new
===
PhabricatorAuthContactNumber
::
STATUS_DISABLED
)
{
return
pht
(
'%s disabled this contact number.'
,
$this
->
renderAuthor
());
}
else
{
return
pht
(
'%s enabled this contact number.'
,
$this
->
renderAuthor
());
}
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
$map
=
PhabricatorAuthContactNumber
::
getStatusNameMap
();
foreach
(
$xactions
as
$xaction
)
{
$new_value
=
$xaction
->
getNewValue
();
if
(!
isset
(
$map
[
$new_value
]))
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Status ("%s") is not a valid contact number status. Valid '
.
'status constants are: %s.'
,
$new_value
,
implode
(
', '
,
array_keys
(
$map
))),
$xaction
);
continue
;
}
$mfa_error
=
$this
->
newContactNumberMFAError
(
$object
,
$xaction
);
if
(
$mfa_error
)
{
$errors
[]
=
$mfa_error
;
continue
;
}
// NOTE: Enabling a contact number may cause us to collide with another
// active contact number. However, there might also be a transaction in
// this group that changes the number itself. Since we can't easily
// predict if we'll collide or not, just let the duplicate key logic
// handle it when we do.
}
return
$errors
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 12:42 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63012
Default Alt Text
PhabricatorAuthContactNumberStatusTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment