@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Removed broken inline comment anchors.

Summary:
Inline comment anchros were present for all different diffs inside a
revision. They were only working for the current diff. Removed the
links that were for different diffs.

I couldn't get the automatic linking to other diffs working, probably
because the anchors didn't work when the page was reloaded. This is also
a bit confusing if the diff changes when clicking on anchor.

We might want to carry all the comments along in the future, but I
don't think it's needed at the moment.

Test Plan:
Tested on a revision, which had inline comments for differerent diffs
that only the comments for the latest diff had anchors when the page
was loaded. Changed the diff manually on the page and made sure the
anchors for that diff were working correctly and the anchors for the
latest diff were not available.

Reviewed By: epriestley
Reviewers: epriestley
CC: jungejason, epriestley
Differential Revision: 142

+23 -7
+1
src/applications/differential/controller/commentpreview/DifferentialCommentPreviewController.php
··· 46 46 $view->setHandles($handles); 47 47 $view->setMarkupEngine($engine); 48 48 $view->setPreview(true); 49 + $view->setTargetDiff(null); 49 50 50 51 $draft = new PhabricatorDraft(); 51 52 $draft
+1
src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php
··· 167 167 $comment_view->setInlineComments($inlines); 168 168 $comment_view->setChangesets($all_changesets); 169 169 $comment_view->setUser($user); 170 + $comment_view->setTargetDiff($target); 170 171 171 172 $diff_history = new DifferentialRevisionUpdateHistoryView(); 172 173 $diff_history->setDiffs($diffs);
+15 -7
src/applications/differential/view/revisioncomment/DifferentialRevisionCommentView.php
··· 24 24 private $preview; 25 25 private $inlines; 26 26 private $changesets; 27 + private $target; 27 28 28 29 public function setComment($comment) { 29 30 $this->comment = $comment; ··· 54 55 // Ship these in sorted by getSortKey() and keyed by ID... or else! 55 56 $this->changesets = $changesets; 56 57 return $this; 58 + } 59 + 60 + public function setTargetDiff($target) { 61 + $this->target = $target; 57 62 } 58 63 59 64 public function render() { ··· 130 135 ($inline->getLineNumber() + $inline->getLineLength()); 131 136 } 132 137 133 - $lines = phutil_render_tag( 134 - 'a', 135 - array( 136 - 'href' => '#inline-'.$inline->getID(), 137 - 'class' => 'num', 138 - ), 139 - $lines); 138 + if (!$this->target || 139 + $changeset->getDiffID() === $this->target->getID()) { 140 + $lines = phutil_render_tag( 141 + 'a', 142 + array( 143 + 'href' => '#inline-'.$inline->getID(), 144 + 'class' => 'num', 145 + ), 146 + $lines); 147 + } 140 148 141 149 $inline_content = $inline->getContent(); 142 150 if (strlen($inline_content)) {
+6
src/applications/differential/view/revisioncommentlist/DifferentialRevisionCommentListView.php
··· 23 23 private $inlines; 24 24 private $changesets; 25 25 private $user; 26 + private $target; 26 27 27 28 public function setComments(array $comments) { 28 29 $this->comments = $comments; ··· 49 50 return $this; 50 51 } 51 52 53 + public function setTargetDiff(DifferentialDiff $target) { 54 + $this->target = $target; 55 + } 56 + 52 57 public function render() { 53 58 54 59 require_celerity_resource('differential-revision-comment-list-css'); ··· 67 72 $view->setMarkupEngine($engine); 68 73 $view->setInlineComments(idx($inlines, $comment->getID(), array())); 69 74 $view->setChangesets($this->changesets); 75 + $view->setTargetDiff($this->target); 70 76 71 77 $html[] = $view->render(); 72 78 }