Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92749331
PhamePostVisibilityTransaction.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
Sat, Nov 23, 10:02
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Nov 25, 10:02 (2 d)
Engine
blob
Format
Raw Data
Handle
22504151
Attached To
rPH Phabricator
PhamePostVisibilityTransaction.php
View Options
<?php
final
class
PhamePostVisibilityTransaction
extends
PhamePostTransactionType
{
const
TRANSACTIONTYPE
=
'phame.post.visibility'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getVisibility
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
if
(
$value
==
PhameConstants
::
VISIBILITY_DRAFT
)
{
$object
->
setDatePublished
(
0
);
}
else
if
(
$value
==
PhameConstants
::
VISIBILITY_ARCHIVED
)
{
$object
->
setDatePublished
(
0
);
}
else
{
$object
->
setDatePublished
(
PhabricatorTime
::
getNow
());
}
$object
->
setVisibility
(
$value
);
}
public
function
getTitle
()
{
$new
=
$this
->
getNewValue
();
if
(
$new
==
PhameConstants
::
VISIBILITY_DRAFT
)
{
return
pht
(
'%s marked this post as a draft.'
,
$this
->
renderAuthor
());
}
else
if
(
$new
==
PhameConstants
::
VISIBILITY_ARCHIVED
)
{
return
pht
(
'%s archived this post.'
,
$this
->
renderAuthor
());
}
else
{
return
pht
(
'%s published this post.'
,
$this
->
renderAuthor
());
}
}
public
function
getTitleForFeed
()
{
$new
=
$this
->
getNewValue
();
if
(
$new
==
PhameConstants
::
VISIBILITY_DRAFT
)
{
return
pht
(
'%s marked %s as a draft.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
else
if
(
$new
==
PhameConstants
::
VISIBILITY_ARCHIVED
)
{
return
pht
(
'%s marked %s as archived.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
else
{
return
pht
(
'%s published %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
}
public
function
getIcon
()
{
$new
=
$this
->
getNewValue
();
if
(
$new
==
PhameConstants
::
VISIBILITY_PUBLISHED
)
{
return
'fa-rss'
;
}
else
if
(
$new
==
PhameConstants
::
VISIBILITY_ARCHIVED
)
{
return
'fa-ban'
;
}
else
{
return
'fa-eye-slash'
;
}
}
}
Event Timeline
Log In to Comment