Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93232444
PholioImageDescriptionTransaction.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, Nov 27, 05:26
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 29, 05:26 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
22587405
Attached To
rPH Phabricator
PholioImageDescriptionTransaction.php
View Options
<?php
final
class
PholioImageDescriptionTransaction
extends
PholioImageTransactionType
{
const
TRANSACTIONTYPE
=
'image-description'
;
public
function
generateOldValue
(
$object
)
{
$description
=
null
;
$phid
=
null
;
$image
=
$this
->
getImageForXaction
(
$object
);
if
(
$image
)
{
$description
=
$image
->
getDescription
();
$phid
=
$image
->
getPHID
();
}
return
array
(
$phid
=>
$description
);
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$image
=
$this
->
getImageForXaction
(
$object
);
$value
=
(
string
)
head
(
$this
->
getNewValue
());
$image
->
setDescription
(
$value
);
$image
->
save
();
}
public
function
getTitle
()
{
$new
=
$this
->
getNewValue
();
return
pht
(
'%s updated an image
\'
s (%s) description.'
,
$this
->
renderAuthor
(),
$this
->
renderHandle
(
head_key
(
$new
)));
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s updated image descriptions of %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
public
function
mergeTransactions
(
$object
,
PhabricatorApplicationTransaction
$u
,
PhabricatorApplicationTransaction
$v
)
{
$raw_new_value_u
=
$u
->
getNewValue
();
$raw_new_value_v
=
$v
->
getNewValue
();
$phid_u
=
head_key
(
$raw_new_value_u
);
$phid_v
=
head_key
(
$raw_new_value_v
);
if
(
$phid_u
==
$phid_v
)
{
return
$v
;
}
return
null
;
}
public
function
shouldHide
()
{
$old
=
$this
->
getOldValue
();
return
(
$old
===
array
(
null
=>
null
));
}
public
function
hasChangeDetailView
()
{
return
true
;
}
public
function
newChangeDetailView
()
{
$viewer
=
$this
->
getViewer
();
return
id
(
new
PhabricatorApplicationTransactionTextDiffDetailView
())
->
setViewer
(
$viewer
)
->
setOldText
(
head
(
$this
->
getOldValue
()))
->
setNewText
(
head
(
$this
->
getNewValue
()));
}
}
Event Timeline
Log In to Comment