mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +01:00
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
This commit is contained in:
parent
425deeb523
commit
b08c9b3ffa
2 changed files with 17 additions and 4 deletions
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue