|
16 | 16 | use SolutionForest\InspireCms\Base\Filament\Resources\Pages\BaseContentCreatePage; |
17 | 17 | use SolutionForest\InspireCms\Base\Filament\Resources\Pages\CreateContentRecord\Concerns\Translatable as CmsCreateContentRecordsTranslatable; |
18 | 18 | use SolutionForest\InspireCms\Filament\Resources\ContentResource; |
| 19 | +use SolutionForest\InspireCms\Helpers\DiffHelper; |
19 | 20 | use SolutionForest\InspireCms\InspireCmsConfig; |
20 | 21 | use SolutionForest\InspireCms\Models\Contracts\Content; |
21 | 22 | use Throwable; |
@@ -234,7 +235,10 @@ public function handlePublishableRecordCreateOrUpdate(array $data, array $publis |
234 | 235 |
|
235 | 236 | $record->setPublishableState($publishableAction); |
236 | 237 |
|
237 | | - $this->propertyDataIsDirtyPreCheck($record->getLatestVersionPropertyData(), $data['propertyData'] ?? []); |
| 238 | + $this->propertyDataIsDirtyPreCheck( |
| 239 | + array_merge($record->getLatestVersionPropertyData(), $record->latestContentVersion?->getVersioningCheckDiffData() ?? []), |
| 240 | + array_merge($data['propertyData'] ?? [], $record->contentVersions()->make([...$publishableData, 'publish_state' => $publishableAction])?->getVersioningCheckDiffData() ?? []), |
| 241 | + ); |
238 | 242 |
|
239 | 243 | $this->record = $this->handleRecordUpdate($record, $data); |
240 | 244 | // endregion Handle Record Updating |
@@ -389,14 +393,7 @@ protected function propertyDataIsDirtyPreCheck($from, $to) |
389 | 393 | return; |
390 | 394 | } |
391 | 395 |
|
392 | | - $modelTmpContentVersion = app(InspireCmsConfig::getContentVersionModelClass(), [ |
393 | | - 'attributes' => [ |
394 | | - 'from_data' => $from, |
395 | | - 'to_data' => $to, |
396 | | - ], |
397 | | - ]); |
398 | | - |
399 | | - $diff = $modelTmpContentVersion->getDifferences(); |
| 396 | + $diff = DiffHelper::compareArrays($from, $to); |
400 | 397 |
|
401 | 398 | // Display notification if no differences found |
402 | 399 | if (empty($diff)) { |
|
0 commit comments