Differential D8957 Diff 21317 src/applications/transactions/view/PhabricatorApplicationTransactionView.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/view/PhabricatorApplicationTransactionView.php
<?php | <?php | ||||
/** | /** | ||||
* @concrete-extensible | * @concrete-extensible | ||||
*/ | */ | ||||
class PhabricatorApplicationTransactionView extends AphrontView { | class PhabricatorApplicationTransactionView extends AphrontView { | ||||
private $transactions; | private $transactions; | ||||
private $engine; | private $engine; | ||||
private $anchorOffset = 1; | private $anchorOffset = 1; | ||||
private $showEditActions = true; | private $showEditActions = true; | ||||
private $isPreview; | private $isPreview; | ||||
private $objectPHID; | private $objectPHID; | ||||
private $shouldTerminate = false; | private $shouldTerminate = false; | ||||
private $quoteTargetID; | |||||
private $quoteRef; | |||||
public function setQuoteRef($quote_ref) { | |||||
$this->quoteRef = $quote_ref; | |||||
return $this; | |||||
} | |||||
public function getQuoteRef() { | |||||
return $this->quoteRef; | |||||
} | |||||
public function setQuoteTargetID($quote_target_id) { | |||||
$this->quoteTargetID = $quote_target_id; | |||||
return $this; | |||||
} | |||||
public function getQuoteTargetID() { | |||||
return $this->quoteTargetID; | |||||
} | |||||
public function setObjectPHID($object_phid) { | public function setObjectPHID($object_phid) { | ||||
$this->objectPHID = $object_phid; | $this->objectPHID = $object_phid; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getObjectPHID() { | public function getObjectPHID() { | ||||
return $this->objectPHID; | return $this->objectPHID; | ||||
▲ Show 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | private function renderEvent( | ||||
$has_removed_comment = $xaction->getComment() && | $has_removed_comment = $xaction->getComment() && | ||||
$xaction->getComment()->getIsRemoved(); | $xaction->getComment()->getIsRemoved(); | ||||
if ($this->getShowEditActions() && !$this->isPreview) { | if ($this->getShowEditActions() && !$this->isPreview) { | ||||
if ($xaction->getCommentVersion() > 1 && !$has_removed_comment) { | if ($xaction->getCommentVersion() > 1 && !$has_removed_comment) { | ||||
$event->setIsEdited(true); | $event->setIsEdited(true); | ||||
} | } | ||||
// If we have a place for quoted text to go and this is a quotable | |||||
// comment, pass the quote target ID to the event view. | |||||
if ($this->getQuoteTargetID()) { | |||||
if ($xaction->hasComment()) { | |||||
if (!$has_removed_comment && !$has_deleted_comment) { | |||||
$event->setQuoteTargetID($this->getQuoteTargetID()); | |||||
$event->setQuoteRef($this->getQuoteRef()); | |||||
} | |||||
} | |||||
} | |||||
$can_edit = PhabricatorPolicyCapability::CAN_EDIT; | $can_edit = PhabricatorPolicyCapability::CAN_EDIT; | ||||
if ($xaction->hasComment() || $has_deleted_comment) { | if ($xaction->hasComment() || $has_deleted_comment) { | ||||
$has_edit_capability = PhabricatorPolicyFilter::hasCapability( | $has_edit_capability = PhabricatorPolicyFilter::hasCapability( | ||||
$viewer, | $viewer, | ||||
$xaction, | $xaction, | ||||
$can_edit); | $can_edit); | ||||
if ($has_edit_capability && !$has_removed_comment) { | if ($has_edit_capability && !$has_removed_comment) { | ||||
Show All 37 Lines |