Commit b08c9b3f authored by epriestley's avatar epriestley
Browse files

Remove extra container tag on HandleListViews rendering from ModularTransactions in text mode

Summary:
Fixes T12082. Ref T11114. When modular transaction render a handle list, they use HandleListView, which has a text mode.

However, the HandleListView is a TagView, and currently TagViews always render a tag of some kind. Allow them to return `null` to decline to render any tag.

Test Plan:
  - Added a pile of debugging stuff to `ApplicationTransactionEditor` to throw during mail generation.
  - Added a reviewer to a revision.
  - Used `bin/worker execute --id ...` to hit the mail generation repeatedly.
  - Before patch: mail generated with a <span>, even in text mode.
  - After patch: clean mail generation.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12082, T11114

Differential Revision: https://secure.phabricator.com/D17162
parent 425deeb5
......@@ -38,9 +38,13 @@ final class PHUIHandleListView
}
protected function getTagName() {
// TODO: It would be nice to render this with a proper <ul />, at least in
// block mode, but don't stir the waters up too much for now.
return 'span';
if ($this->getAsText()) {
return null;
} else {
// TODO: It would be nice to render this with a proper <ul />, at least
// in block mode, but don't stir the waters up too much for now.
return 'span';
}
}
protected function getTagContent() {
......
......@@ -92,6 +92,15 @@ abstract class AphrontTagView extends AphrontView {
final public function render() {
$this->willRender();
// A tag view may render no tag at all. For example, the HandleListView is
// a container which renders a tag in HTML mode, but can also render in
// text mode without producing a tag. When a tag view has no tag name, just
// return the tag content as though the view did not exist.
$tag_name = $this->getTagName();
if ($tag_name === null) {
return $this->getTagContent();
}
$attributes = $this->getTagAttributes();
$implode = array('class', 'sigil');
......@@ -147,7 +156,7 @@ abstract class AphrontTagView extends AphrontView {
}
return javelin_tag(
$this->getTagName(),
$tag_name,
$attributes,
$this->getTagContent());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment