mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 12:30:56 +01:00
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
This commit is contained in:
parent
927407c426
commit
40554e2d8a
4 changed files with 23 additions and 7 deletions
|
@ -46,6 +46,7 @@ class DifferentialCommentPreviewController extends DifferentialController {
|
|||
$view->setHandles($handles);
|
||||
$view->setMarkupEngine($engine);
|
||||
$view->setPreview(true);
|
||||
$view->setTargetDiff(null);
|
||||
|
||||
$draft = new PhabricatorDraft();
|
||||
$draft
|
||||
|
|
|
@ -167,6 +167,7 @@ class DifferentialRevisionViewController extends DifferentialController {
|
|||
$comment_view->setInlineComments($inlines);
|
||||
$comment_view->setChangesets($all_changesets);
|
||||
$comment_view->setUser($user);
|
||||
$comment_view->setTargetDiff($target);
|
||||
|
||||
$diff_history = new DifferentialRevisionUpdateHistoryView();
|
||||
$diff_history->setDiffs($diffs);
|
||||
|
|
|
@ -24,6 +24,7 @@ final class DifferentialRevisionCommentView extends AphrontView {
|
|||
private $preview;
|
||||
private $inlines;
|
||||
private $changesets;
|
||||
private $target;
|
||||
|
||||
public function setComment($comment) {
|
||||
$this->comment = $comment;
|
||||
|
@ -56,6 +57,10 @@ final class DifferentialRevisionCommentView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setTargetDiff($target) {
|
||||
$this->target = $target;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
require_celerity_resource('phabricator-remarkup-css');
|
||||
|
@ -130,13 +135,16 @@ final class DifferentialRevisionCommentView extends AphrontView {
|
|||
($inline->getLineNumber() + $inline->getLineLength());
|
||||
}
|
||||
|
||||
$lines = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#inline-'.$inline->getID(),
|
||||
'class' => 'num',
|
||||
),
|
||||
$lines);
|
||||
if (!$this->target ||
|
||||
$changeset->getDiffID() === $this->target->getID()) {
|
||||
$lines = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#inline-'.$inline->getID(),
|
||||
'class' => 'num',
|
||||
),
|
||||
$lines);
|
||||
}
|
||||
|
||||
$inline_content = $inline->getContent();
|
||||
if (strlen($inline_content)) {
|
||||
|
|
|
@ -23,6 +23,7 @@ final class DifferentialRevisionCommentListView extends AphrontView {
|
|||
private $inlines;
|
||||
private $changesets;
|
||||
private $user;
|
||||
private $target;
|
||||
|
||||
public function setComments(array $comments) {
|
||||
$this->comments = $comments;
|
||||
|
@ -49,6 +50,10 @@ final class DifferentialRevisionCommentListView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setTargetDiff(DifferentialDiff $target) {
|
||||
$this->target = $target;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
require_celerity_resource('differential-revision-comment-list-css');
|
||||
|
@ -67,6 +72,7 @@ final class DifferentialRevisionCommentListView extends AphrontView {
|
|||
$view->setMarkupEngine($engine);
|
||||
$view->setInlineComments(idx($inlines, $comment->getID(), array()));
|
||||
$view->setChangesets($this->changesets);
|
||||
$view->setTargetDiff($this->target);
|
||||
|
||||
$html[] = $view->render();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue