Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F538286
PhabricatorApplicationTransactionCommentHistoryController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorApplicationTransactionCommentHistoryController.php
View Options
<?php
final
class
PhabricatorApplicationTransactionCommentHistoryController
extends
PhabricatorApplicationTransactionController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$this
->
getViewer
();
$phid
=
$request
->
getURIData
(
'phid'
);
$xaction
=
id
(
new
PhabricatorObjectQuery
())
->
withPHIDs
(
array
(
$phid
))
->
setViewer
(
$viewer
)
->
executeOne
();
if
(!
$xaction
)
{
return
new
Aphront404Response
();
}
if
(!
$xaction
->
getComment
())
{
// You can't view history of a transaction with no comments.
return
new
Aphront404Response
();
}
if
(
$xaction
->
getComment
()->
getIsRemoved
())
{
// You can't view history of a transaction with a removed comment.
return
new
Aphront400Response
();
}
$comments
=
id
(
new
PhabricatorApplicationTransactionTemplatedCommentQuery
())
->
setViewer
(
$viewer
)
->
setTemplate
(
$xaction
->
getApplicationTransactionCommentObject
())
->
withTransactionPHIDs
(
array
(
$xaction
->
getPHID
()))
->
execute
();
if
(!
$comments
)
{
return
new
Aphront404Response
();
}
$comments
=
msort
(
$comments
,
'getCommentVersion'
);
$xactions
=
array
();
foreach
(
$comments
as
$comment
)
{
$xactions
[]
=
id
(
clone
$xaction
)
->
makeEphemeral
()
->
setCommentVersion
(
$comment
->
getCommentVersion
())
->
setContentSource
(
$comment
->
getContentSource
())
->
setDateCreated
(
$comment
->
getDateCreated
())
->
attachComment
(
$comment
);
}
$obj_phid
=
$xaction
->
getObjectPHID
();
$obj_handle
=
id
(
new
PhabricatorHandleQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
array
(
$obj_phid
))
->
executeOne
();
$view
=
id
(
new
PhabricatorApplicationTransactionView
())
->
setUser
(
$viewer
)
->
setObjectPHID
(
$obj_phid
)
->
setTransactions
(
$xactions
)
->
setShowEditActions
(
false
)
->
setHideCommentOptions
(
true
);
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$viewer
)
->
setWidth
(
AphrontDialogView
::
WIDTH_FULL
)
->
setFlush
(
true
)
->
setTitle
(
pht
(
'Comment History'
));
$dialog
->
appendChild
(
$view
);
$dialog
->
addCancelButton
(
$obj_handle
->
getURI
());
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 8:40 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
119937
Default Alt Text
PhabricatorApplicationTransactionCommentHistoryController.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment