Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97902748
PholioTransaction.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, Jan 7, 09:34
Size
3 KB
Mime Type
text/x-php
Expires
Thu, Jan 9, 09:34 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23436167
Attached To
rPH Phabricator
PholioTransaction.php
View Options
<?php
/**
* @group pholio
*/
final
class
PholioTransaction
extends
PhabricatorApplicationTransaction
{
public
function
getApplicationName
()
{
return
'pholio'
;
}
public
function
getApplicationTransactionType
()
{
return
PhabricatorPHIDConstants
::
PHID_TYPE_MOCK
;
}
public
function
getApplicationTransactionCommentObject
()
{
return
new
PholioTransactionComment
();
}
public
function
getApplicationTransactionViewObject
()
{
return
new
PholioTransactionView
();
}
public
function
getApplicationObjectTypeName
()
{
return
pht
(
'mock'
);
}
public
function
shouldHide
()
{
$old
=
$this
->
getOldValue
();
switch
(
$this
->
getTransactionType
())
{
case
PholioTransactionType
::
TYPE_NAME
:
case
PholioTransactionType
::
TYPE_DESCRIPTION
:
return
(
$old
===
null
);
}
return
parent
::
shouldHide
();
}
public
function
getIcon
()
{
switch
(
$this
->
getTransactionType
())
{
case
PholioTransactionType
::
TYPE_INLINE
:
return
'comment'
;
}
return
parent
::
getIcon
();
}
public
function
getTitle
()
{
$author_phid
=
$this
->
getAuthorPHID
();
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
$type
=
$this
->
getTransactionType
();
switch
(
$type
)
{
case
PholioTransactionType
::
TYPE_NAME
:
return
pht
(
'%s renamed this mock from "%s" to "%s".'
,
$this
->
renderHandleLink
(
$author_phid
),
$old
,
$new
);
break
;
case
PholioTransactionType
::
TYPE_DESCRIPTION
:
return
pht
(
"%s updated the mock's description."
,
$this
->
renderHandleLink
(
$author_phid
));
break
;
case
PholioTransactionType
::
TYPE_INLINE
:
$count
=
1
;
foreach
(
$this
->
getTransactionGroup
()
as
$xaction
)
{
if
(
$xaction
->
getTransactionType
()
==
$type
)
{
$count
++;
}
}
return
pht
(
'%s added %d inline comment(s).'
,
$this
->
renderHandleLink
(
$author_phid
),
$count
);
}
return
parent
::
getTitle
();
}
public
function
getTitleForFeed
()
{
$author_phid
=
$this
->
getAuthorPHID
();
$object_phid
=
$this
->
getObjectPHID
();
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
$type
=
$this
->
getTransactionType
();
switch
(
$type
)
{
case
PholioTransactionType
::
TYPE_NAME
:
if
(
$old
===
null
)
{
return
pht
(
'%s created %s.'
,
$this
->
renderHandleLink
(
$author_phid
),
$this
->
renderHandleLink
(
$object_phid
));
}
else
{
return
pht
(
'%s renamed %s from "%s" to "%s".'
,
$this
->
renderHandleLink
(
$author_phid
),
$this
->
renderHandleLink
(
$object_phid
),
$old
,
$new
);
}
break
;
case
PholioTransactionType
::
TYPE_DESCRIPTION
:
return
pht
(
'%s updated the description for %s.'
,
$this
->
renderHandleLink
(
$author_phid
),
$this
->
renderHandleLink
(
$object_phid
));
break
;
case
PholioTransactionType
::
TYPE_INLINE
:
return
pht
(
'%s added an inline comment to %s.'
,
$this
->
renderHandleLink
(
$author_phid
),
$this
->
renderHandleLink
(
$object_phid
));
break
;
}
return
parent
::
getTitleForFeed
();
}
public
function
hasChangeDetails
()
{
switch
(
$this
->
getTransactionType
())
{
case
PholioTransactionType
::
TYPE_DESCRIPTION
:
return
true
;
}
return
parent
::
hasChangeDetails
();
}
public
function
renderChangeDetails
(
PhabricatorUser
$viewer
)
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
$view
=
id
(
new
PhabricatorApplicationTransactionTextDiffDetailView
())
->
setUser
(
$viewer
)
->
setOldText
(
$old
)
->
setNewText
(
$new
);
return
$view
->
render
();
}
}
Event Timeline
Log In to Comment