Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F683278
PhamePostBlogTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhamePostBlogTransaction.php
View Options
<?php
final
class
PhamePostBlogTransaction
extends
PhamePostTransactionType
{
const
TRANSACTIONTYPE
=
'phame.post.blog'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getBlogPHID
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setBlogPHID
(
$value
);
}
public
function
getTitle
()
{
return
pht
(
'%s changed the blog for this post.'
,
$this
->
renderAuthor
());
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s changed the blog for post %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getBlogPHID
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Posts must be attached to a blog.'
));
}
foreach
(
$xactions
as
$xaction
)
{
$new_phid
=
$xaction
->
getNewValue
();
$blog
=
id
(
new
PhameBlogQuery
())
->
setViewer
(
$this
->
getActor
())
->
withPHIDs
(
array
(
$new_phid
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
execute
();
if
(
$blog
)
{
continue
;
}
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'The specified blog PHID ("%s") is not valid. You can only '
.
'create a post on (or move a post into) a blog which you '
.
'have permission to see and edit.'
,
$new_phid
));
}
return
$errors
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 27, 11:21 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
171829
Default Alt Text
PhamePostBlogTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment