Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15410272
D8209.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D8209.diff
View Options
Index: src/applications/differential/conduit/ConduitAPI_differential_getrevisioncomments_Method.php
===================================================================
--- src/applications/differential/conduit/ConduitAPI_differential_getrevisioncomments_Method.php
+++ src/applications/differential/conduit/ConduitAPI_differential_getrevisioncomments_Method.php
@@ -53,6 +53,7 @@
}
foreach ($comments as $comment) {
+ // TODO: Sort this out in the ID -> PHID change.
$revision_id = $comment->getRevisionID();
$result = array(
'revisionID' => $revision_id,
Index: src/applications/differential/controller/DifferentialCommentPreviewController.php
===================================================================
--- src/applications/differential/controller/DifferentialCommentPreviewController.php
+++ src/applications/differential/controller/DifferentialCommentPreviewController.php
@@ -10,14 +10,20 @@
}
public function processRequest() {
-
$request = $this->getRequest();
+ $viewer = $request->getUser();
+
+ $revision = id(new DifferentialRevisionQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($this->id))
+ ->executeOne();
+ if (!$revision) {
+ return new Aphront404Response();
+ }
- $author_phid = $request->getUser()->getPHID();
-
+ $author_phid = $viewer->getPHID();
$action = $request->getStr('action');
-
$comment = new DifferentialComment();
$comment->setContent($request->getStr('content'));
$comment->setAction($action);
@@ -51,6 +57,7 @@
$view->setComment($comment);
$view->setHandles($handles);
$view->setMarkupEngine($engine);
+ $view->setRevision($revision);
$view->setPreview(true);
$view->setTargetDiff(null);
Index: src/applications/differential/controller/DifferentialRevisionViewController.php
===================================================================
--- src/applications/differential/controller/DifferentialRevisionViewController.php
+++ src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -266,6 +266,7 @@
$comment_view->setUser($user);
$comment_view->setTargetDiff($target);
$comment_view->setVersusDiffID($diff_vs);
+ $comment_view->setRevision($revision);
if ($arc_project) {
Javelin::initBehavior(
Index: src/applications/differential/view/DifferentialRevisionCommentListView.php
===================================================================
--- src/applications/differential/view/DifferentialRevisionCommentListView.php
+++ src/applications/differential/view/DifferentialRevisionCommentListView.php
@@ -9,6 +9,16 @@
private $target;
private $versusDiffID;
private $id;
+ private $revision;
+
+ public function setRevision(DifferentialRevision $revision) {
+ $this->revision = $revision;
+ return $this;
+ }
+
+ public function getRevision() {
+ return $this->revision;
+ }
public function setComments(array $comments) {
assert_instances_of($comments, 'DifferentialComment');
@@ -86,6 +96,7 @@
$view->setInlineComments(idx($inlines, $comment->getID(), array()));
$view->setChangesets($this->changesets);
$view->setTargetDiff($this->target);
+ $view->setRevision($this->getRevision());
$view->setVersusDiffID($this->versusDiffID);
if ($comment->getAction() == DifferentialAction::ACTION_SUMMARIZE) {
$view->setAnchorName('summary');
Index: src/applications/differential/view/DifferentialRevisionCommentView.php
===================================================================
--- src/applications/differential/view/DifferentialRevisionCommentView.php
+++ src/applications/differential/view/DifferentialRevisionCommentView.php
@@ -11,6 +11,16 @@
private $target;
private $anchorName;
private $versusDiffID;
+ private $revision;
+
+ public function setRevision(DifferentialRevision $revision) {
+ $this->revision = $revision;
+ return $this;
+ }
+
+ public function getRevision() {
+ return $this->revision;
+ }
public function setComment($comment) {
$this->comment = $comment;
@@ -134,7 +144,7 @@
$diff_link = phutil_tag(
'a',
array(
- 'href' => '/D'.$comment->getRevisionID().'?id='.$diff_id,
+ 'href' => '/D'.$this->getRevision()->getID().'?id='.$diff_id,
),
'Diff #'.$diff_id);
$actions[] = pht(
@@ -190,7 +200,7 @@
$xaction_view->setEpoch($comment->getDateCreated());
if ($this->anchorName) {
$anchor_text =
- 'D'.$comment->getRevisionID().
+ 'D'.$this->getRevision()->getID().
'#'.preg_replace('/^comment-/', '', $this->anchorName);
$xaction_view->setAnchor($this->anchorName, $anchor_text);
@@ -279,7 +289,7 @@
$diff_id = $changeset->getDiffID();
$item['where'] = '(On Diff #'.$diff_id.')';
$item['href'] =
- 'D'.$this->comment->getRevisionID().
+ 'D'.$this->getRevision()->getID().
'?id='.$diff_id.
'#inline-'.$inline->getID();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 6:59 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7631884
Default Alt Text
D8209.diff (5 KB)
Attached To
Mode
D8209: Reduce reliance on `getRevisionID()` on DifferentialComment
Attached
Detach File
Event Timeline
Log In to Comment