Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F118095614
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, Jun 17, 16:08
Size
2 KB
Mime Type
text/x-php
Expires
Thu, Jun 19, 16:08 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
26797265
Attached To
rPH Phabricator
PholioTransaction.php
View Options
<?php
/**
* @group pholio
*/
final
class
PholioTransaction
extends
PholioDAO
implements
PhabricatorMarkupInterface
{
const
MARKUP_FIELD_COMMENT
=
'markup:comment'
;
protected
$mockID
;
protected
$authorPHID
;
protected
$transactionType
;
protected
$oldValue
;
protected
$newValue
;
protected
$comment
=
''
;
protected
$metadata
=
array
();
protected
$contentSource
;
public
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_SERIALIZATION
=>
array
(
'oldValue'
=>
self
::
SERIALIZATION_JSON
,
'newValue'
=>
self
::
SERIALIZATION_JSON
,
'metadata'
=>
self
::
SERIALIZATION_JSON
,
),
)
+
parent
::
getConfiguration
();
}
public
function
setContentSource
(
PhabricatorContentSource
$content_source
)
{
$this
->
contentSource
=
$content_source
->
serialize
();
return
$this
;
}
public
function
getContentSource
()
{
return
PhabricatorContentSource
::
newFromSerialized
(
$this
->
contentSource
);
}
public
function
getRequiredHandlePHIDs
()
{
switch
(
$this
->
getTransactionType
())
{
case
PholioTransactionType
::
TYPE_SUBSCRIBERS
:
return
array_merge
(
$this
->
getOldValue
(),
$this
->
getNewValue
());
default
:
return
array
();
}
}
/* -( PhabricatorSubscribableInterface Implementation )-------------------- */
public
function
isAutomaticallySubscribed
(
$phid
)
{
return
(
$this
->
authorPHID
==
$phid
);
}
/* -( PhabricatorPolicyInterface Implementation )-------------------------- */
public
function
getCapabilities
()
{
return
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
);
}
public
function
getPolicy
(
$capability
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
return
$this
->
getViewPolicy
();
case
PhabricatorPolicyCapability
::
CAN_EDIT
:
return
PhabricatorPolicies
::
POLICY_NOONE
;
}
}
public
function
hasAutomaticCapbility
(
$capability
,
PhabricatorUser
$viewer
)
{
return
(
$viewer
->
getPHID
()
==
$this
->
getAuthorPHID
());
}
/* -( PhabricatorMarkupInterface )----------------------------------------- */
public
function
getMarkupFieldKey
(
$field
)
{
return
'MX:'
.
$this
->
getID
();
}
public
function
newMarkupEngine
(
$field
)
{
return
PhabricatorMarkupEngine
::
newMarkupEngine
(
array
());
}
public
function
getMarkupText
(
$field
)
{
return
$this
->
getComment
();
}
public
function
didMarkupText
(
$field
,
$output
,
PhutilMarkupEngine
$engine
)
{
return
$output
;
}
public
function
shouldUseMarkupCache
(
$field
)
{
return
(
bool
)
$this
->
getID
();
}
}
Event Timeline
Log In to Comment