mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
Fix an issue where non-ID changeset state keys were used as changeset IDs
Summary: Ref T13519. This is a little fuzzy, but I think the workflow here is: - View an intradiff, generating an ephemeral comparison changeset with no changeset ID. This produces a state key of "*". - Apply "hidden" state changes to the changeset. - View some other intradiff and/or diff view. - The code attempts to use "*" as a changset ID? I'm not entirely sure this is accurate; this was observed in production and I couldn't get a clean reproduction case locally. Optimistically, try making changeset IDs explicit rather than relying on state keys to be "usually changeset-ID-like". Test Plan: Used "hidden" locally across multiple intradiffs, but I wasn't cleanly able to reproduce the initial issue. Maniphest Tasks: T13519 Differential Revision: https://secure.phabricator.com/D21223
This commit is contained in:
parent
6b69102990
commit
a590db28b2
2 changed files with 14 additions and 5 deletions
|
@ -49,6 +49,11 @@ final class DifferentialViewState
|
|||
$properties['diffID'] = (int)$diff_id;
|
||||
}
|
||||
|
||||
$changeset_id = $changeset->getID();
|
||||
if ($changeset_id !== null) {
|
||||
$properties['changesetID'] = (int)$changeset_id;
|
||||
}
|
||||
|
||||
$path_hash = $this->getChangesetPathHash($changeset);
|
||||
$changeset_phid = $this->getChangesetKey($changeset);
|
||||
|
||||
|
|
|
@ -197,12 +197,12 @@ final class PhabricatorChangesetViewStateEngine
|
|||
$entries = isort($entries, 'epoch');
|
||||
|
||||
if ($entries) {
|
||||
$other_key = last_key($entries);
|
||||
$other_spec = last($entries);
|
||||
|
||||
$this_version = (int)$changeset->getDiffID();
|
||||
$other_version = (int)idx($other_spec, 'diffID');
|
||||
$other_value = (bool)idx($other_spec, 'value', false);
|
||||
$other_id = (int)idx($other_spec, 'changesetID');
|
||||
|
||||
if ($other_value === false) {
|
||||
$is_hidden = false;
|
||||
|
@ -211,10 +211,14 @@ final class PhabricatorChangesetViewStateEngine
|
|||
} else {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
if ($other_id) {
|
||||
$other_changeset = id(new DifferentialChangesetQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($other_key))
|
||||
->withIDs(array($other_id))
|
||||
->executeOne();
|
||||
} else {
|
||||
$other_changeset = null;
|
||||
}
|
||||
|
||||
$is_modified = false;
|
||||
if ($other_changeset) {
|
||||
|
|
Loading…
Reference in a new issue