mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-10 23:01:04 +01:00
Improve remarkup metadata robustness against debris in the database
Summary: Ref T13682. Versioned drafts may have missing or unexpected metadata: - versioned drafts from an older version of Phabricator may be missing metadata; - versioned drafts created by an older UI against a newer version of Phabricator may have `null` metadata. Generally, make these workflows robust to metadata in unexpected formats, so database debris doesn't break the UI. Test Plan: Simulated debris, interacted with UI. Maniphest Tasks: T13682 Differential Revision: https://secure.phabricator.com/D21849
This commit is contained in:
parent
809ae81752
commit
835cd7f270
2 changed files with 10 additions and 1 deletions
|
@ -244,7 +244,12 @@ abstract class PhabricatorApplicationTransaction
|
|||
->setNewValue($new_value);
|
||||
}
|
||||
|
||||
$metadata = $this->getMetadataValue('remarkup.control', array());
|
||||
$metadata = $this->getMetadataValue('remarkup.control');
|
||||
|
||||
if (!is_array($metadata)) {
|
||||
$metadata = array();
|
||||
}
|
||||
|
||||
foreach ($changes as $change) {
|
||||
if (!$change->getMetadata()) {
|
||||
$change->setMetadata($metadata);
|
||||
|
|
|
@ -325,6 +325,10 @@ final class PhabricatorApplicationTransactionCommentView
|
|||
}
|
||||
|
||||
$remarkup_control->setValue($draft_comment);
|
||||
|
||||
if (!is_array($draft_metadata)) {
|
||||
$draft_metadata = array();
|
||||
}
|
||||
$remarkup_control->setRemarkupMetadata($draft_metadata);
|
||||
|
||||
if (!$this->getObjectPHID()) {
|
||||
|
|
Loading…
Reference in a new issue