mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-06 05:36:13 +01:00
Avoid "Unknown Object (????)" for custom Select field values in Herald editor
Summary: Custom Select field values are rendered as `Unknown Object (????)` when set as Herald rule conditions and editing the Herald rule. This is unhelpful; at least display their key value. Closes T15860 Test Plan: Create a `"type": "select"` custom field via `/config/edit/maniphest.custom-field-definitions/`, set up a Herald rule with a condition based on that custom field, edit the Herald rule. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15860 Differential Revision: https://we.phorge.it/D25696
This commit is contained in:
parent
89be7a51d8
commit
a68b8daafd
1 changed files with 13 additions and 0 deletions
|
@ -168,6 +168,19 @@ final class PhabricatorObjectHandle
|
||||||
if ($this->name === null) {
|
if ($this->name === null) {
|
||||||
if ($this->getPolicyFiltered()) {
|
if ($this->getPolicyFiltered()) {
|
||||||
return pht('Restricted %s', $this->getTypeName());
|
return pht('Restricted %s', $this->getTypeName());
|
||||||
|
} else if ($this->getPHID() && $this->getTypeName() ===
|
||||||
|
PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN) {
|
||||||
|
// Values of custom Select field conditions in Herald rules do not have
|
||||||
|
// a PHID (and no PHID type) as they are arbitrary text when loadPage()
|
||||||
|
// in PhabricatorHandleQuery calls $type = phid_get_type($phid).
|
||||||
|
// Thus the code lower in this class cannot pull a name to render for
|
||||||
|
// these non-existing PHIDs either.
|
||||||
|
// In this case, render their PHID (the actual Select field key value).
|
||||||
|
// This is always more informative than 'Unknown Object (????)' though
|
||||||
|
// still imperfect as it displays the key instead of the user-friendly
|
||||||
|
// name value defined in maniphest.custom-field-definitions.
|
||||||
|
// https://we.phorge.it/T15860
|
||||||
|
return $this->getPHID();
|
||||||
} else {
|
} else {
|
||||||
return pht('Unknown Object (%s)', $this->getTypeName());
|
return pht('Unknown Object (%s)', $this->getTypeName());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue