1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 07:32:39 +01:00

Fixed item export with deleted creator/updated

Added test to cover.
Fixes #2733
This commit is contained in:
Dan Brown 2021-05-05 22:52:08 +01:00
parent 95798a2eba
commit a083ceaf44
2 changed files with 19 additions and 2 deletions

View File

@ -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 ?? ''),
]) !!}
<br>
@icon('edit'){!! trans('entities.meta_updated' . ($entity->updatedBy ? '_name' : ''), [
'timeLength' => $entity->updated_at->toDayDateTimeString(),
'user' => htmlentities($entity->updatedBy->name)
'user' => e($entity->updatedBy->name ?? '')
]) !!}
</div>

View File

@ -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');
}
}