mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Transactions - hide "mentioned in X" story if you can't see X
Summary: ...also re-jiggers all the anchor stuff to use $xaction ID. This seemed like the simplest way once I got in the code, as well as having nice properties for if / when we want to re-add some ajax stuff since the ID is a pretty solid piece of data to key off. Fixes T6083. Test Plan: mentioned DX in private DX+1. Could see on DX the mention as me and not as the other user. For transactions, I left a comment on Paste and it worked, and I edited an existing transaction and it worked. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T6083 Differential Revision: https://secure.phabricator.com/D10488
This commit is contained in:
parent
936ee22de1
commit
444ced16d9
12 changed files with 20 additions and 45 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue