diff --git a/src/applications/files/controller/PhabricatorFileCommentController.php b/src/applications/files/controller/PhabricatorFileCommentController.php index 16e6e3f3a9..c527e6fc12 100644 --- a/src/applications/files/controller/PhabricatorFileCommentController.php +++ b/src/applications/files/controller/PhabricatorFileCommentController.php @@ -58,8 +58,7 @@ final class PhabricatorFileCommentController extends PhabricatorFileController { return id(new PhabricatorApplicationTransactionResponse()) ->setViewer($user) ->setTransactions($xactions) - ->setIsPreview($is_preview) - ->setAnchorOffset($request->getStr('anchor')); + ->setIsPreview($is_preview); } else { return id(new AphrontRedirectResponse()) ->setURI($view_uri); diff --git a/src/applications/legalpad/controller/LegalpadDocumentCommentController.php b/src/applications/legalpad/controller/LegalpadDocumentCommentController.php index 823e150010..f0f557d67f 100644 --- a/src/applications/legalpad/controller/LegalpadDocumentCommentController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentCommentController.php @@ -69,8 +69,7 @@ final class LegalpadDocumentCommentController extends LegalpadController { return id(new PhabricatorApplicationTransactionResponse()) ->setViewer($user) ->setTransactions($xactions) - ->setIsPreview($is_preview) - ->setAnchorOffset($request->getStr('anchor')); + ->setIsPreview($is_preview); } else { return id(new AphrontRedirectResponse())->setURI($document_uri); } diff --git a/src/applications/macro/controller/PhabricatorMacroCommentController.php b/src/applications/macro/controller/PhabricatorMacroCommentController.php index a53adc689e..f438e9b31a 100644 --- a/src/applications/macro/controller/PhabricatorMacroCommentController.php +++ b/src/applications/macro/controller/PhabricatorMacroCommentController.php @@ -59,8 +59,7 @@ final class PhabricatorMacroCommentController return id(new PhabricatorApplicationTransactionResponse()) ->setViewer($user) ->setTransactions($xactions) - ->setIsPreview($is_preview) - ->setAnchorOffset($request->getStr('anchor')); + ->setIsPreview($is_preview); } else { return id(new AphrontRedirectResponse()) ->setURI($view_uri); diff --git a/src/applications/paste/controller/PhabricatorPasteCommentController.php b/src/applications/paste/controller/PhabricatorPasteCommentController.php index 44727ecef5..cd35c4a36e 100644 --- a/src/applications/paste/controller/PhabricatorPasteCommentController.php +++ b/src/applications/paste/controller/PhabricatorPasteCommentController.php @@ -59,8 +59,7 @@ final class PhabricatorPasteCommentController return id(new PhabricatorApplicationTransactionResponse()) ->setViewer($user) ->setTransactions($xactions) - ->setIsPreview($is_preview) - ->setAnchorOffset($request->getStr('anchor')); + ->setIsPreview($is_preview); } else { return id(new AphrontRedirectResponse()) ->setURI($view_uri); diff --git a/src/applications/pholio/controller/PholioMockCommentController.php b/src/applications/pholio/controller/PholioMockCommentController.php index a862e89adc..d0c55ec66a 100644 --- a/src/applications/pholio/controller/PholioMockCommentController.php +++ b/src/applications/pholio/controller/PholioMockCommentController.php @@ -81,8 +81,7 @@ final class PholioMockCommentController extends PholioController { ->setViewer($user) ->setTransactions($xactions) ->setTransactionView($xaction_view) - ->setIsPreview($is_preview) - ->setAnchorOffset($request->getStr('anchor')); + ->setIsPreview($is_preview); } else { return id(new AphrontRedirectResponse())->setURI($mock_uri); } diff --git a/src/applications/ponder/controller/PonderAnswerCommentController.php b/src/applications/ponder/controller/PonderAnswerCommentController.php index 6c22111833..b59dd4259c 100644 --- a/src/applications/ponder/controller/PonderAnswerCommentController.php +++ b/src/applications/ponder/controller/PonderAnswerCommentController.php @@ -60,8 +60,7 @@ final class PonderAnswerCommentController extends PonderController { return id(new PhabricatorApplicationTransactionResponse()) ->setViewer($viewer) ->setTransactions($xactions) - ->setIsPreview($is_preview) - ->setAnchorOffset($request->getStr('anchor')); + ->setIsPreview($is_preview); } else { return id(new AphrontRedirectResponse()) ->setURI($view_uri); diff --git a/src/applications/ponder/controller/PonderQuestionCommentController.php b/src/applications/ponder/controller/PonderQuestionCommentController.php index 814a8857e8..f4d56db622 100644 --- a/src/applications/ponder/controller/PonderQuestionCommentController.php +++ b/src/applications/ponder/controller/PonderQuestionCommentController.php @@ -59,8 +59,7 @@ final class PonderQuestionCommentController extends PonderController { return id(new PhabricatorApplicationTransactionResponse()) ->setViewer($viewer) ->setTransactions($xactions) - ->setIsPreview($is_preview) - ->setAnchorOffset($request->getStr('anchor')); + ->setIsPreview($is_preview); } else { return id(new AphrontRedirectResponse()) ->setURI($view_uri); diff --git a/src/applications/releeph/controller/request/ReleephRequestCommentController.php b/src/applications/releeph/controller/request/ReleephRequestCommentController.php index 5e7e6e7b2c..4c728341af 100644 --- a/src/applications/releeph/controller/request/ReleephRequestCommentController.php +++ b/src/applications/releeph/controller/request/ReleephRequestCommentController.php @@ -59,8 +59,7 @@ final class ReleephRequestCommentController return id(new PhabricatorApplicationTransactionResponse()) ->setViewer($viewer) ->setTransactions($xactions) - ->setIsPreview($is_preview) - ->setAnchorOffset($request->getStr('anchor')); + ->setIsPreview($is_preview); } else { return id(new AphrontRedirectResponse()) ->setURI($view_uri); diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteCommentController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteCommentController.php index f0046df374..588f06b649 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvoteCommentController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvoteCommentController.php @@ -59,8 +59,7 @@ final class PhabricatorSlowvoteCommentController return id(new PhabricatorApplicationTransactionResponse()) ->setViewer($user) ->setTransactions($xactions) - ->setIsPreview($is_preview) - ->setAnchorOffset($request->getStr('anchor')); + ->setIsPreview($is_preview); } else { return id(new AphrontRedirectResponse()) ->setURI($view_uri); diff --git a/src/applications/transactions/response/PhabricatorApplicationTransactionResponse.php b/src/applications/transactions/response/PhabricatorApplicationTransactionResponse.php index cf936d9a11..7d4066cfda 100644 --- a/src/applications/transactions/response/PhabricatorApplicationTransactionResponse.php +++ b/src/applications/transactions/response/PhabricatorApplicationTransactionResponse.php @@ -5,7 +5,6 @@ final class PhabricatorApplicationTransactionResponse private $viewer; private $transactions; - private $anchorOffset; private $isPreview; private $transactionView; @@ -22,15 +21,6 @@ final class PhabricatorApplicationTransactionResponse return new AphrontAjaxResponse(); } - public function setAnchorOffset($anchor_offset) { - $this->anchorOffset = $anchor_offset; - return $this; - } - - public function getAnchorOffset() { - return $this->anchorOffset; - } - public function setTransactions($transactions) { assert_instances_of($transactions, 'PhabricatorApplicationTransaction'); @@ -71,10 +61,6 @@ final class PhabricatorApplicationTransactionResponse ->setTransactions($this->getTransactions()) ->setIsPreview($this->isPreview); - if ($this->getAnchorOffset()) { - $view->setAnchorOffset($this->getAnchorOffset()); - } - if ($this->isPreview) { $xactions = mpull($view->buildEvents(), 'render'); } else { diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index 0f916b2365..b651f387cc 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -445,6 +445,14 @@ abstract class PhabricatorApplicationTransaction return true; break; case PhabricatorObjectMentionedByObject::EDGECONST: + $new = ipull($this->getNewValue(), 'dst'); + $old = ipull($this->getOldValue(), 'dst'); + $add = array_diff($new, $old); + $add_value = reset($add); + $add_handle = $this->getHandle($add_value); + if ($add_handle->getPolicyFiltered()) { + return true; + } return false; break; default: diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php index 2a1d32a242..4a1f5cfac3 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php @@ -7,7 +7,6 @@ class PhabricatorApplicationTransactionView extends AphrontView { private $transactions; private $engine; - private $anchorOffset = 1; private $showEditActions = true; private $isPreview; private $objectPHID; @@ -56,11 +55,6 @@ class PhabricatorApplicationTransactionView extends AphrontView { return $this->showEditActions; } - public function setAnchorOffset($anchor_offset) { - $this->anchorOffset = $anchor_offset; - return $this; - } - public function setMarkupEngine(PhabricatorMarkupEngine $engine) { $this->engine = $engine; return $this; @@ -80,8 +74,6 @@ class PhabricatorApplicationTransactionView extends AphrontView { public function buildEvents($with_hiding = false) { $user = $this->getUser(); - $anchor = $this->anchorOffset; - $xactions = $this->transactions; $xactions = $this->filterHiddenTransactions($xactions); @@ -130,9 +122,8 @@ class PhabricatorApplicationTransactionView extends AphrontView { $group_event = null; foreach ($group as $xaction) { - $event = $this->renderEvent($xaction, $group, $anchor); + $event = $this->renderEvent($xaction, $group); $event->setHideByDefault($hide_by_default); - $anchor++; if (!$group_event) { $group_event = $event; } else { @@ -325,8 +316,7 @@ class PhabricatorApplicationTransactionView extends AphrontView { private function renderEvent( PhabricatorApplicationTransaction $xaction, - array $group, - $anchor) { + array $group) { $viewer = $this->getUser(); $event = id(new PHUITimelineEventView()) @@ -370,7 +360,7 @@ class PhabricatorApplicationTransactionView extends AphrontView { $event ->setDateCreated($xaction->getDateCreated()) ->setContentSource($xaction->getContentSource()) - ->setAnchor($anchor); + ->setAnchor($xaction->getID()); } $transaction_type = $xaction->getTransactionType();