From: Marcel Werk Date: Thu, 4 Apr 2024 15:49:35 +0000 (+0200) Subject: Show the comparison with the previous version by default X-Git-Tag: 6.1.0_Alpha_1~133^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f32e8e76afe7f4dd108827f1171fe215a083176f;p=GitHub%2FWoltLab%2FWCF.git Show the comparison with the previous version by default --- diff --git a/wcfsetup/install/files/lib/page/EditHistoryPage.class.php b/wcfsetup/install/files/lib/page/EditHistoryPage.class.php index 5b2a6c1190..1fe186fcda 100644 --- a/wcfsetup/install/files/lib/page/EditHistoryPage.class.php +++ b/wcfsetup/install/files/lib/page/EditHistoryPage.class.php @@ -170,10 +170,21 @@ class EditHistoryPage extends AbstractPage $this->objectList->getConditionBuilder()->add('objectID = ?', [$this->objectID]); $this->objectList->readObjects(); - $differ = Diff::getDefaultDiffer(); + // set default values + if (!isset($_REQUEST['oldID']) && !isset($_REQUEST['newID'])) { + foreach ($this->objectList as $object) { + $this->oldID = $object->entryID; + $this->old = $object; + break; + } + $this->newID = 'current'; + $this->new = $this->object; + } // valid IDs were given, calculate diff if ($this->old && $this->new) { + $differ = Diff::getDefaultDiffer(); + $a = \explode("\n", $this->prepareMessage($this->old->getMessage())); $b = \explode("\n", $this->prepareMessage($this->new->getMessage())); $this->diff = Diff::rawDiffFromSebastianDiff($differ->diffToArray($a, $b)); @@ -211,15 +222,6 @@ class EditHistoryPage extends AbstractPage } } } - - // set default values - if (!isset($_REQUEST['oldID']) && !isset($_REQUEST['newID'])) { - foreach ($this->objectList as $object) { - $this->oldID = $object->entryID; - break; - } - $this->newID = 'current'; - } } private function prepareMessage(string $message): string