Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98252749
PhrictionDocumentContentTransaction.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, Jan 11, 11:52
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Jan 13, 11:52 (2 d)
Engine
blob
Format
Raw Data
Handle
23541737
Attached To
rPH Phabricator
PhrictionDocumentContentTransaction.php
View Options
<?php
final
class
PhrictionDocumentContentTransaction
extends
PhrictionDocumentVersionTransaction
{
const
TRANSACTIONTYPE
=
'content'
;
public
function
generateOldValue
(
$object
)
{
if
(
$this
->
getEditor
()->
getIsNewObject
())
{
return
null
;
}
return
$object
->
getContent
()->
getContent
();
}
public
function
generateNewValue
(
$object
,
$value
)
{
return
$value
;
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setStatus
(
PhrictionDocumentStatus
::
STATUS_EXISTS
);
$content
=
$this
->
getNewDocumentContent
(
$object
);
$content
->
setContent
(
$value
);
}
public
function
shouldHide
()
{
if
(
$this
->
getOldValue
()
===
null
)
{
return
true
;
}
else
{
return
false
;
}
}
public
function
getActionStrength
()
{
return
1.3
;
}
public
function
getActionName
()
{
return
pht
(
'Edited'
);
}
public
function
getTitle
()
{
return
pht
(
'%s edited the content of this document.'
,
$this
->
renderAuthor
());
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s edited the content of %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
public
function
hasChangeDetailView
()
{
return
true
;
}
public
function
getMailDiffSectionHeader
()
{
return
pht
(
'CHANGES TO DOCUMENT CONTENT'
);
}
public
function
newChangeDetailView
()
{
$viewer
=
$this
->
getViewer
();
return
id
(
new
PhabricatorApplicationTransactionTextDiffDetailView
())
->
setViewer
(
$viewer
)
->
setOldText
(
$this
->
getOldValue
())
->
setNewText
(
$this
->
getNewValue
());
}
public
function
newRemarkupChanges
()
{
$changes
=
array
();
$changes
[]
=
$this
->
newRemarkupChange
()
->
setOldValue
(
$this
->
getOldValue
())
->
setNewValue
(
$this
->
getNewValue
());
return
$changes
;
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
$content
=
$object
->
getContent
()->
getContent
();
if
(
$this
->
isEmptyTextTransaction
(
$content
,
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Documents must have content.'
));
}
return
$errors
;
}
}
Event Timeline
Log In to Comment