1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Break all old differential comment anchors

Test Plan: Display revision, verify text, click on links.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Maniphest Tasks: T845

Differential Revision: https://secure.phabricator.com/D1591
This commit is contained in:
vrana 2012-02-07 14:36:17 -08:00
parent 4caa684724
commit 3e3f73235c
4 changed files with 16 additions and 9 deletions

View file

@ -25,7 +25,7 @@ final class DifferentialRevisionCommentView extends AphrontView {
private $inlines;
private $changesets;
private $target;
private $commentNumber;
private $anchorName;
private $user;
private $versusDiffID;
@ -70,8 +70,8 @@ final class DifferentialRevisionCommentView extends AphrontView {
return $this;
}
public function setCommentNumber($comment_number) {
$this->commentNumber = $comment_number;
public function setAnchorName($anchor_name) {
$this->anchorName = $anchor_name;
return $this;
}
@ -111,10 +111,9 @@ final class DifferentialRevisionCommentView extends AphrontView {
$info[] = $date;
$comment_anchor = null;
$num = $this->commentNumber;
if ($num && !$this->preview) {
$anchor_name = $this->anchorName;
if ($anchor_name != '' && !$this->preview) {
Javelin::initBehavior('phabricator-watch-anchor');
$anchor_name = 'comment-'.$num;
$info[] = phutil_render_tag(
'a',
array(
@ -122,7 +121,7 @@ final class DifferentialRevisionCommentView extends AphrontView {
'id' => $anchor_name,
'href' => '#'.$anchor_name,
),
'Comment D'.$comment->getRevisionID().'#'.$num);
'D'.$comment->getRevisionID().'#'.$anchor_name);
$comment_anchor = 'anchor-'.$anchor_name;
}

View file

@ -83,7 +83,14 @@ final class DifferentialRevisionCommentListView extends AphrontView {
$view->setChangesets($this->changesets);
$view->setTargetDiff($this->target);
$view->setVersusDiffID($this->versusDiffID);
$view->setCommentNumber($num++);
if ($comment->getAction() == DifferentialAction::ACTION_SUMMARIZE) {
$view->setAnchorName('summary');
} elseif ($comment->getAction() == DifferentialAction::ACTION_TESTPLAN) {
$view->setAnchorName('test-plan');
} else {
$view->setAnchorName('comment-'.$num);
$num++;
}
$html[] = $view->render();
}

View file

@ -6,6 +6,7 @@
phutil_require_module('phabricator', 'applications/differential/constants/action');
phutil_require_module('phabricator', 'applications/differential/view/revisioncomment');
phutil_require_module('phabricator', 'applications/markup/engine');
phutil_require_module('phabricator', 'infrastructure/celerity/api');

View file

@ -233,7 +233,7 @@ class ManiphestTransactionDetailView extends ManiphestView {
'id' => $anchor_name,
'href' => '#'.$anchor_name,
),
'Comment T'.$any_transaction->getTaskID().'#'.$num);
'T'.$any_transaction->getTaskID().'#'.$anchor_name);
$comment_anchor = 'anchor-'.$anchor_name;
}