mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Render inline comments somewhat-correctly on 1-up diffs
Summary: You can't interact with them yey, but do a less awful job of rendering them. Test Plan: {F29204} Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2009 Differential Revision: https://secure.phabricator.com/D4426
This commit is contained in:
parent
ea8faedf0b
commit
901328088d
4 changed files with 44 additions and 35 deletions
|
@ -293,7 +293,7 @@ abstract class DifferentialChangesetHTMLRenderer
|
|||
'</table>';
|
||||
}
|
||||
|
||||
protected function renderShield($message, $force = 'default') {
|
||||
public function renderShield($message, $force = 'default') {
|
||||
$end = count($this->getOldLines());
|
||||
$reference = $this->getRenderingReference();
|
||||
|
||||
|
@ -333,7 +333,8 @@ abstract class DifferentialChangesetHTMLRenderer
|
|||
'Show File Contents');
|
||||
}
|
||||
|
||||
return javelin_render_tag(
|
||||
return $this->wrapChangeInTable(
|
||||
javelin_render_tag(
|
||||
'tr',
|
||||
array(
|
||||
'sigil' => 'context-target',
|
||||
|
@ -341,7 +342,7 @@ abstract class DifferentialChangesetHTMLRenderer
|
|||
'<td class="differential-shield" colspan="6">'.
|
||||
phutil_escape_html($message).
|
||||
$more.
|
||||
'</td>');
|
||||
'</td>'));
|
||||
}
|
||||
|
||||
protected function wrapChangeInTable($content) {
|
||||
|
@ -358,5 +359,30 @@ abstract class DifferentialChangesetHTMLRenderer
|
|||
$content);
|
||||
}
|
||||
|
||||
protected function renderInlineComment(
|
||||
PhabricatorInlineCommentInterface $comment,
|
||||
$on_right = false) {
|
||||
|
||||
return $this->buildInlineComment($comment, $on_right)->render();
|
||||
}
|
||||
|
||||
protected function buildInlineComment(
|
||||
PhabricatorInlineCommentInterface $comment,
|
||||
$on_right = false) {
|
||||
|
||||
$user = $this->getUser();
|
||||
$edit = $user &&
|
||||
($comment->getAuthorPHID() == $user->getPHID()) &&
|
||||
($comment->isDraft());
|
||||
$allow_reply = (bool)$user;
|
||||
|
||||
return id(new DifferentialInlineCommentView())
|
||||
->setInlineComment($comment)
|
||||
->setOnRight($on_right)
|
||||
->setHandles($this->getHandles())
|
||||
->setMarkupEngine($this->getMarkupEngine())
|
||||
->setEditable($edit)
|
||||
->setAllowReply($allow_reply);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,10 +45,13 @@ final class DifferentialChangesetOneUpRenderer
|
|||
break;
|
||||
case 'inline':
|
||||
$out[] = '<tr><th /><th />';
|
||||
$out[] = '<td style="background: #ddd; color: #888;">';
|
||||
$out[] = '<td>';
|
||||
|
||||
$out[] = 'INLINE COMMENT<br />';
|
||||
$out[] = phutil_escape_html($p['comment']->getContent());
|
||||
$inline = $this->buildInlineComment(
|
||||
$p['comment'],
|
||||
$p['right']);
|
||||
$inline->setBuildScaffolding(false);
|
||||
$out[] = $inline->render();
|
||||
|
||||
$out[] = '</td></tr>';
|
||||
break;
|
||||
|
|
|
@ -298,30 +298,10 @@ abstract class DifferentialChangesetRenderer {
|
|||
* @param string|null Force mode, see above.
|
||||
* @return string Shield markup.
|
||||
*/
|
||||
abstract protected function renderShield($message, $force = 'default');
|
||||
abstract public function renderShield($message, $force = 'default');
|
||||
|
||||
abstract protected function renderPropertyChangeHeader();
|
||||
|
||||
protected function renderInlineComment(
|
||||
PhabricatorInlineCommentInterface $comment,
|
||||
$on_right = false) {
|
||||
|
||||
$user = $this->getUser();
|
||||
$edit = $user &&
|
||||
($comment->getAuthorPHID() == $user->getPHID()) &&
|
||||
($comment->isDraft());
|
||||
$allow_reply = (bool)$user;
|
||||
|
||||
return id(new DifferentialInlineCommentView())
|
||||
->setInlineComment($comment)
|
||||
->setOnRight($on_right)
|
||||
->setHandles($this->getHandles())
|
||||
->setMarkupEngine($this->getMarkupEngine())
|
||||
->setEditable($edit)
|
||||
->setAllowReply($allow_reply)
|
||||
->render();
|
||||
}
|
||||
|
||||
protected function buildPrimitives($range_start, $range_len) {
|
||||
$primitives = array();
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ abstract class DifferentialChangesetTestRenderer
|
|||
"{$away}\n";
|
||||
}
|
||||
|
||||
protected function renderShield($message, $force = 'default') {
|
||||
public function renderShield($message, $force = 'default') {
|
||||
return "SHIELD ({$force}) {$message}\n";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue