1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Fix comment anchor jump highlighting

Summary: I accidentally broke the feature where we highlight comments which are
jumped to via anchor in D1327. We now test that the jump was sucessful by
looking for an item with the anchor ID, but we were only setting 'name'.
Instead, set 'id' as well so the highlighting code detects that the jump was
successful and adds the highlight class.

Test Plan: Clicked "Comment D1234#7" or whatever, got a nice yellow background.

Reviewers: btrahan, nh, jungejason

Reviewed By: btrahan

CC: aran, epriestley

Maniphest Tasks: T796

Differential Revision: https://secure.phabricator.com/D1471
This commit is contained in:
epriestley 2012-01-23 17:09:39 -08:00
parent 7d1f62409d
commit 3c8bb8a608
2 changed files with 11 additions and 8 deletions

View file

@ -114,14 +114,16 @@ final class DifferentialRevisionCommentView extends AphrontView {
$num = $this->commentNumber;
if ($num && !$this->preview) {
Javelin::initBehavior('phabricator-watch-anchor');
$anchor_name = 'comment-'.$num;
$info[] = phutil_render_tag(
'a',
array(
'name' => 'comment-'.$num,
'href' => '#comment-'.$num,
'name' => $anchor_name,
'id' => $anchor_name,
'href' => '#'.$anchor_name,
),
'Comment D'.$comment->getRevisionID().'#'.$num);
$comment_anchor = 'anchor-comment-'.$num;
$comment_anchor = 'anchor-'.$anchor_name;
}
$info = implode(' · ', array_filter($info));

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -225,17 +225,18 @@ class ManiphestTransactionDetailView extends ManiphestView {
$num = $this->commentNumber;
if ($num && !$this->preview) {
Javelin::initBehavior('phabricator-watch-anchor');
$anchor_name = 'comment-'.$num;
$info[] = javelin_render_tag(
'a',
array(
'name' => 'comment-'.$num,
'href' => '#comment-'.$num,
'name' => $anchor_name,
'id' => $anchor_name,
'href' => '#'.$anchor_name,
),
'Comment T'.$any_transaction->getTaskID().'#'.$num);
$comment_anchor = 'anchor-comment-'.$num;
$comment_anchor = 'anchor-'.$anchor_name;
}
$info = implode(' &middot; ', array_filter($info));
return phutil_render_tag(