From a083ceaf44b87cf6a4062d6ed8f01eb75b6a5f43 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 5 May 2021 22:52:08 +0100 Subject: [PATCH] Fixed item export with deleted creator/updated Added test to cover. Fixes #2733 --- .../views/partials/entity-export-meta.blade.php | 4 ++-- tests/Entity/ExportTest.php | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/resources/views/partials/entity-export-meta.blade.php b/resources/views/partials/entity-export-meta.blade.php index a84d0ae85..32b26750e 100644 --- a/resources/views/partials/entity-export-meta.blade.php +++ b/resources/views/partials/entity-export-meta.blade.php @@ -5,12 +5,12 @@ @icon('star'){!! trans('entities.meta_created' . ($entity->createdBy ? '_name' : ''), [ 'timeLength' => $entity->created_at->toDayDateTimeString(), - 'user' => htmlentities($entity->createdBy->name), + 'user' => e($entity->createdBy->name ?? ''), ]) !!}
@icon('edit'){!! trans('entities.meta_updated' . ($entity->updatedBy ? '_name' : ''), [ 'timeLength' => $entity->updated_at->toDayDateTimeString(), - 'user' => htmlentities($entity->updatedBy->name) + 'user' => e($entity->updatedBy->name ?? '') ]) !!} \ No newline at end of file diff --git a/tests/Entity/ExportTest.php b/tests/Entity/ExportTest.php index d04ccc69a..482e82ae6 100644 --- a/tests/Entity/ExportTest.php +++ b/tests/Entity/ExportTest.php @@ -230,4 +230,21 @@ class ExportTest extends TestCase } } + public function test_page_export_with_deleted_creator_and_updater() + { + $user = $this->getViewer(['name' => 'ExportWizardTheFifth']); + $page = Page::first(); + $page->created_by = $user->id; + $page->updated_by = $user->id; + $page->save(); + + $resp = $this->asEditor()->get($page->getUrl('/export/html')); + $resp->assertSee('ExportWizardTheFifth'); + + $user->delete(); + $resp = $this->get($page->getUrl('/export/html')); + $resp->assertStatus(200); + $resp->assertDontSee('ExportWizardTheFifth'); + } + }