Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97003010
PhabricatorRepositorySymbolSourcesTransaction.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 1, 13:03
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jan 3, 13:03 (2 d)
Engine
blob
Format
Raw Data
Handle
23310303
Attached To
rPH Phabricator
PhabricatorRepositorySymbolSourcesTransaction.php
View Options
<?php
final
class
PhabricatorRepositorySymbolSourcesTransaction
extends
PhabricatorRepositoryTransactionType
{
const
TRANSACTIONTYPE
=
'repo:symbol-source'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getSymbolSources
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setDetail
(
'symbol-sources'
,
$value
);
}
public
function
getTitle
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
if
(
$old
)
{
$display_old
=
$this
->
renderHandleList
(
$old
);
}
else
{
$display_old
=
$this
->
renderValue
(
pht
(
'None'
));
}
if
(
$new
)
{
$display_new
=
$this
->
renderHandleList
(
$new
);
}
else
{
$display_new
=
$this
->
renderValue
(
pht
(
'None'
));
}
return
pht
(
'%s changed symbol sources from %s to %s.'
,
$this
->
renderAuthor
(),
$display_old
,
$display_new
);
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
foreach
(
$xactions
as
$xaction
)
{
$old
=
$object
->
getSymbolSources
();
$new
=
$xaction
->
getNewValue
();
// If the viewer is adding new repositories, make sure they are
// valid and visible.
$add
=
array_diff
(
$new
,
$old
);
if
(!
$add
)
{
continue
;
}
$repositories
=
id
(
new
PhabricatorRepositoryQuery
())
->
setViewer
(
$this
->
getActor
())
->
withPHIDs
(
$add
)
->
execute
();
$repositories
=
mpull
(
$repositories
,
null
,
'getPHID'
);
foreach
(
$add
as
$phid
)
{
if
(
isset
(
$repositories
[
$phid
]))
{
continue
;
}
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Repository ("%s") does not exist, or you do not have '
.
'permission to see it.'
,
$phid
),
$xaction
);
break
;
}
}
return
$errors
;
}
}
Event Timeline
Log In to Comment