Skip to content

NOW MANAGED ON CODEBERG

Removed user and revision links in export meta

Dan Brown6a4b020dd884
diff --git a/resources/sass/export-styles.scss b/resources/sass/export-styles.scss
index 6d9a1a718..278e5b6c5 100644
--- a/resources/sass/export-styles.scss
+++ b/resources/sass/export-styles.scss
@@ -19,6 +19,7 @@ body {
font-family: 'DejaVu Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", "Ubuntu", "Roboto", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
margin: 0;
padding: 0;
+ display: block;
}
table {
diff --git a/resources/views/partials/entity-export-meta.blade.php b/resources/views/partials/entity-export-meta.blade.php
index fa1394ed4..a84d0ae85 100644
--- a/resources/views/partials/entity-export-meta.blade.php
+++ b/resources/views/partials/entity-export-meta.blade.php
@@ -1,33 +1,16 @@
<div class="entity-meta">
- @if($entity->isA('revision'))
- @icon('history'){{ trans('entities.pages_revision') }}
- {{ trans('entities.pages_revisions_number') }}{{ $entity->revision_number == 0 ? '' : $entity->revision_number }}
- <br>
- @endif
-
@if ($entity->isA('page'))
- @if (userCan('page-update', $entity)) <a href="{{ $entity->getUrl('/revisions') }}"> @endif
@icon('history'){{ trans('entities.meta_revision', ['revisionCount' => $entity->revision_count]) }} <br>
- @if (userCan('page-update', $entity))</a>@endif
- @endif
-
- @if ($entity->createdBy)
- @icon('star'){!! trans('entities.meta_created_name', [
- 'timeLength' => '<span>'.$entity->created_at->toDayDateTimeString() . '</span>',
- 'user' => "<a href='{$entity->createdBy->getProfileUrl()}'>".htmlentities($entity->createdBy->name). "</a>"
- ]) !!}
- @else
- @icon('star')<span>{{ trans('entities.meta_created', ['timeLength' => $entity->created_at->toDayDateTimeString()]) }}</span>
@endif
+ @icon('star'){!! trans('entities.meta_created' . ($entity->createdBy ? '_name' : ''), [
+ 'timeLength' => $entity->created_at->toDayDateTimeString(),
+ 'user' => htmlentities($entity->createdBy->name),
+ ]) !!}
<br>
- @if ($entity->updatedBy)
- @icon('edit'){!! trans('entities.meta_updated_name', [
- 'timeLength' => '<span>' . $entity->updated_at->toDayDateTimeString() .'</span>',
- 'user' => "<a href='{$entity->updatedBy->getProfileUrl()}'>".htmlentities($entity->updatedBy->name). "</a>"
- ]) !!}
- @elseif (!$entity->isA('revision'))
- @icon('edit')<span>{{ trans('entities.meta_updated', ['timeLength' => $entity->updated_at->toDayDateTimeString()]) }}</span>
- @endif
+ @icon('edit'){!! trans('entities.meta_updated' . ($entity->updatedBy ? '_name' : ''), [
+ 'timeLength' => $entity->updated_at->toDayDateTimeString(),
+ 'user' => htmlentities($entity->updatedBy->name)
+ ]) !!}
</div>
\ No newline at end of file
diff --git a/tests/Entity/ExportTest.php b/tests/Entity/ExportTest.php
index 1e44f015a..05672c6ca 100644
--- a/tests/Entity/ExportTest.php
+++ b/tests/Entity/ExportTest.php
@@ -1,6 +1,5 @@
<?php namespace Tests\Entity;
-
use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Page;
use Illuminate\Support\Facades\Storage;
@@ -151,6 +150,16 @@ class ExportTest extends TestCase
$resp->assertDontSee($page->updated_at->diffForHumans());
}
+ public function test_page_export_does_not_include_user_or_revision_links()
+ {
+ $page = Page::first();
+
+ $resp = $this->asEditor()->get($page->getUrl('/export/html'));
+ $resp->assertDontSee($page->getUrl('/revisions'));
+ $resp->assertDontSee($page->createdBy->getProfileUrl());
+ $resp->assertSee($page->createdBy->name);
+ }
+
public function test_page_export_sets_right_data_type_for_svg_embeds()
{
$page = Page::first();