Skip to content

Commit 444ced1

Browse files
committedSep 16, 2014
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
1 parent 936ee22 commit 444ced1

12 files changed

+20
-45
lines changed
 

‎src/applications/files/controller/PhabricatorFileCommentController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public function processRequest() {
5858
return id(new PhabricatorApplicationTransactionResponse())
5959
->setViewer($user)
6060
->setTransactions($xactions)
61-
->setIsPreview($is_preview)
62-
->setAnchorOffset($request->getStr('anchor'));
61+
->setIsPreview($is_preview);
6362
} else {
6463
return id(new AphrontRedirectResponse())
6564
->setURI($view_uri);

‎src/applications/legalpad/controller/LegalpadDocumentCommentController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public function processRequest() {
6969
return id(new PhabricatorApplicationTransactionResponse())
7070
->setViewer($user)
7171
->setTransactions($xactions)
72-
->setIsPreview($is_preview)
73-
->setAnchorOffset($request->getStr('anchor'));
72+
->setIsPreview($is_preview);
7473
} else {
7574
return id(new AphrontRedirectResponse())->setURI($document_uri);
7675
}

‎src/applications/macro/controller/PhabricatorMacroCommentController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public function processRequest() {
5959
return id(new PhabricatorApplicationTransactionResponse())
6060
->setViewer($user)
6161
->setTransactions($xactions)
62-
->setIsPreview($is_preview)
63-
->setAnchorOffset($request->getStr('anchor'));
62+
->setIsPreview($is_preview);
6463
} else {
6564
return id(new AphrontRedirectResponse())
6665
->setURI($view_uri);

‎src/applications/paste/controller/PhabricatorPasteCommentController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public function processRequest() {
5959
return id(new PhabricatorApplicationTransactionResponse())
6060
->setViewer($user)
6161
->setTransactions($xactions)
62-
->setIsPreview($is_preview)
63-
->setAnchorOffset($request->getStr('anchor'));
62+
->setIsPreview($is_preview);
6463
} else {
6564
return id(new AphrontRedirectResponse())
6665
->setURI($view_uri);

‎src/applications/pholio/controller/PholioMockCommentController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public function processRequest() {
8181
->setViewer($user)
8282
->setTransactions($xactions)
8383
->setTransactionView($xaction_view)
84-
->setIsPreview($is_preview)
85-
->setAnchorOffset($request->getStr('anchor'));
84+
->setIsPreview($is_preview);
8685
} else {
8786
return id(new AphrontRedirectResponse())->setURI($mock_uri);
8887
}

‎src/applications/ponder/controller/PonderAnswerCommentController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ public function processRequest() {
6060
return id(new PhabricatorApplicationTransactionResponse())
6161
->setViewer($viewer)
6262
->setTransactions($xactions)
63-
->setIsPreview($is_preview)
64-
->setAnchorOffset($request->getStr('anchor'));
63+
->setIsPreview($is_preview);
6564
} else {
6665
return id(new AphrontRedirectResponse())
6766
->setURI($view_uri);

‎src/applications/ponder/controller/PonderQuestionCommentController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public function processRequest() {
5959
return id(new PhabricatorApplicationTransactionResponse())
6060
->setViewer($viewer)
6161
->setTransactions($xactions)
62-
->setIsPreview($is_preview)
63-
->setAnchorOffset($request->getStr('anchor'));
62+
->setIsPreview($is_preview);
6463
} else {
6564
return id(new AphrontRedirectResponse())
6665
->setURI($view_uri);

‎src/applications/releeph/controller/request/ReleephRequestCommentController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public function processRequest() {
5959
return id(new PhabricatorApplicationTransactionResponse())
6060
->setViewer($viewer)
6161
->setTransactions($xactions)
62-
->setIsPreview($is_preview)
63-
->setAnchorOffset($request->getStr('anchor'));
62+
->setIsPreview($is_preview);
6463
} else {
6564
return id(new AphrontRedirectResponse())
6665
->setURI($view_uri);

‎src/applications/slowvote/controller/PhabricatorSlowvoteCommentController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public function processRequest() {
5959
return id(new PhabricatorApplicationTransactionResponse())
6060
->setViewer($user)
6161
->setTransactions($xactions)
62-
->setIsPreview($is_preview)
63-
->setAnchorOffset($request->getStr('anchor'));
62+
->setIsPreview($is_preview);
6463
} else {
6564
return id(new AphrontRedirectResponse())
6665
->setURI($view_uri);

‎src/applications/transactions/response/PhabricatorApplicationTransactionResponse.php

-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ final class PhabricatorApplicationTransactionResponse
55

66
private $viewer;
77
private $transactions;
8-
private $anchorOffset;
98
private $isPreview;
109
private $transactionView;
1110

@@ -22,15 +21,6 @@ protected function buildProxy() {
2221
return new AphrontAjaxResponse();
2322
}
2423

25-
public function setAnchorOffset($anchor_offset) {
26-
$this->anchorOffset = $anchor_offset;
27-
return $this;
28-
}
29-
30-
public function getAnchorOffset() {
31-
return $this->anchorOffset;
32-
}
33-
3424
public function setTransactions($transactions) {
3525
assert_instances_of($transactions, 'PhabricatorApplicationTransaction');
3626

@@ -71,10 +61,6 @@ public function reduceProxyResponse() {
7161
->setTransactions($this->getTransactions())
7262
->setIsPreview($this->isPreview);
7363

74-
if ($this->getAnchorOffset()) {
75-
$view->setAnchorOffset($this->getAnchorOffset());
76-
}
77-
7864
if ($this->isPreview) {
7965
$xactions = mpull($view->buildEvents(), 'render');
8066
} else {

‎src/applications/transactions/storage/PhabricatorApplicationTransaction.php

+8
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,14 @@ public function shouldHide() {
445445
return true;
446446
break;
447447
case PhabricatorObjectMentionedByObject::EDGECONST:
448+
$new = ipull($this->getNewValue(), 'dst');
449+
$old = ipull($this->getOldValue(), 'dst');
450+
$add = array_diff($new, $old);
451+
$add_value = reset($add);
452+
$add_handle = $this->getHandle($add_value);
453+
if ($add_handle->getPolicyFiltered()) {
454+
return true;
455+
}
448456
return false;
449457
break;
450458
default:

‎src/applications/transactions/view/PhabricatorApplicationTransactionView.php

+3-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class PhabricatorApplicationTransactionView extends AphrontView {
77

88
private $transactions;
99
private $engine;
10-
private $anchorOffset = 1;
1110
private $showEditActions = true;
1211
private $isPreview;
1312
private $objectPHID;
@@ -56,11 +55,6 @@ public function getShowEditActions() {
5655
return $this->showEditActions;
5756
}
5857

59-
public function setAnchorOffset($anchor_offset) {
60-
$this->anchorOffset = $anchor_offset;
61-
return $this;
62-
}
63-
6458
public function setMarkupEngine(PhabricatorMarkupEngine $engine) {
6559
$this->engine = $engine;
6660
return $this;
@@ -80,8 +74,6 @@ public function setShouldTerminate($term) {
8074
public function buildEvents($with_hiding = false) {
8175
$user = $this->getUser();
8276

83-
$anchor = $this->anchorOffset;
84-
8577
$xactions = $this->transactions;
8678

8779
$xactions = $this->filterHiddenTransactions($xactions);
@@ -130,9 +122,8 @@ public function buildEvents($with_hiding = false) {
130122

131123
$group_event = null;
132124
foreach ($group as $xaction) {
133-
$event = $this->renderEvent($xaction, $group, $anchor);
125+
$event = $this->renderEvent($xaction, $group);
134126
$event->setHideByDefault($hide_by_default);
135-
$anchor++;
136127
if (!$group_event) {
137128
$group_event = $event;
138129
} else {
@@ -325,8 +316,7 @@ private function groupDisplayTransactions(array $xactions) {
325316

326317
private function renderEvent(
327318
PhabricatorApplicationTransaction $xaction,
328-
array $group,
329-
$anchor) {
319+
array $group) {
330320
$viewer = $this->getUser();
331321

332322
$event = id(new PHUITimelineEventView())
@@ -370,7 +360,7 @@ private function renderEvent(
370360
$event
371361
->setDateCreated($xaction->getDateCreated())
372362
->setContentSource($xaction->getContentSource())
373-
->setAnchor($anchor);
363+
->setAnchor($xaction->getID());
374364
}
375365

376366
$transaction_type = $xaction->getTransactionType();

0 commit comments

Comments
 (0)
Failed to load comments.