Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98738555
PhabricatorSlowvoteQuestionTransaction.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
Thu, Jan 16, 02:01
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jan 18, 02:01 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23636623
Attached To
rPH Phabricator
PhabricatorSlowvoteQuestionTransaction.php
View Options
<?php
final
class
PhabricatorSlowvoteQuestionTransaction
extends
PhabricatorSlowvoteTransactionType
{
const
TRANSACTIONTYPE
=
'vote:question'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getQuestion
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setQuestion
(
$value
);
}
public
function
getTitle
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
if
(
$old
===
null
)
{
return
pht
(
'%s created this poll.'
,
$this
->
renderAuthor
());
}
else
{
return
pht
(
'%s changed the poll question from "%s" to "%s".'
,
$this
->
renderAuthor
(),
$old
,
$new
);
}
}
public
function
getTitleForFeed
()
{
$old
=
$this
->
getOldValue
();
if
(
$old
===
null
)
{
return
pht
(
'%s created %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
else
{
return
pht
(
'%s renamed %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
}
public
function
getIcon
()
{
$old
=
$this
->
getOldValue
();
if
(
$old
===
null
)
{
return
'fa-plus'
;
}
else
{
return
'fa-pencil'
;
}
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getQuestion
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Polls must have a question.'
));
}
return
$errors
;
}
}
Event Timeline
Log In to Comment