Skip to content

Commit

Permalink
BUG Fix issue with Security link being wrong
Browse files Browse the repository at this point in the history
fixes #689
  • Loading branch information
tractorcow committed Mar 23, 2021
1 parent 6044c7e commit 1f570e9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Model/RecordLocale.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,18 @@ public function getRecord()
return $this->record ?: null;
}

// If record isn't saved, use draft record
if (!$this->originalRecord->isInDB()) {
return $this->originalRecord;
// If record isn't saved, clone the draft record, but mark it
// as belonging to the current locale
$originalRecord = $this->getOriginalRecord();
if (!$originalRecord->isInDB()) {
$localeRecord = clone $originalRecord;
$localeRecord->setSourceQueryParam('Fluent.Locale', $this->getLocale());
return $localeRecord;
}

// Reload localised record in the corret locale
$record = FluentState::singleton()->withState(function (FluentState $newState) {
$record = FluentState::singleton()->withState(function (FluentState $newState) use ($originalRecord) {
$newState->setLocale($this->getLocale());
$originalRecord = $this->getOriginalRecord();
return $originalRecord->get()->byID($originalRecord->ID);
});

Expand Down

0 comments on commit 1f570e9

Please sign in to comment.