NOW MANAGED ON CODEBERG
Updated page revisions link visibility
Dan Brown2fe261e20729
diff --git a/resources/views/entities/meta.blade.php b/resources/views/entities/meta.blade.phpindex ac91eeed3..7ad61f1b1 100644--- a/resources/views/entities/meta.blade.php+++ b/resources/views/entities/meta.blade.php@@ -10,9 +10,9 @@@endif@if ($entity->isA('page'))- @if (userCan('page-update', $entity)) <a href="{{ $entity->getUrl('/revisions') }}" class="entity-meta-item"> @else <div class="entity-meta-item"> @endif- @icon('history'){{ trans('entities.meta_revision', ['revisionCount' => $entity->revision_count]) }}- @if (userCan('page-update', $entity))</a> @else </div> @endif+ <a href="{{ $entity->getUrl('/revisions') }}" class="entity-meta-item">+ @icon('history'){{ trans('entities.meta_revision', ['revisionCount' => $entity->revision_count]) }}+ </a>@endif@if ($entity->ownedBy && $entity->owned_by !== $entity->created_by)diff --git a/resources/views/pages/show.blade.php b/resources/views/pages/show.blade.phpindex 45d2e2d7f..b2c57c319 100644--- a/resources/views/pages/show.blade.php+++ b/resources/views/pages/show.blade.php@@ -163,11 +163,11 @@<span>{{ trans('common.move') }}</span></a>@endif- <a href="{{ $page->getUrl('/revisions') }}" class="icon-list-item">- <span>@icon('history')</span>- <span>{{ trans('entities.revisions') }}</span>- </a>@endif+ <a href="{{ $page->getUrl('/revisions') }}" class="icon-list-item">+ <span>@icon('history')</span>+ <span>{{ trans('entities.revisions') }}</span>+ </a>@if(userCan('restrictions-manage', $page))<a href="{{ $page->getUrl('/permissions') }}" class="icon-list-item"><span>@icon('lock')</span>diff --git a/tests/Entity/PageRevisionTest.php b/tests/Entity/PageRevisionTest.phpindex 78bf2dec2..01252eda9 100644--- a/tests/Entity/PageRevisionTest.php+++ b/tests/Entity/PageRevisionTest.php@@ -9,6 +9,18 @@ use Tests\TestCase;class PageRevisionTest extends TestCase{++ public function test_revision_links_visible_to_viewer()+ {+ /** @var Page $page */+ $page = Page::query()->first();++ $html = $this->withHtml($this->asViewer()->get($page->getUrl()));+ $html->assertLinkExists($page->getUrl('/revisions'));+ $html->assertElementContains('a', 'Revisions');+ $html->assertElementContains('a', 'Revision #1');+ }+public function test_page_revision_views_viewable(){$this->asEditor();diff --git a/tests/TestCase.php b/tests/TestCase.phpindex 3ca7638c8..f17d27a1a 100644--- a/tests/TestCase.php+++ b/tests/TestCase.php@@ -89,6 +89,14 @@ abstract class TestCase extends BaseTestCasereturn $this->editor;}+ /**+ * Set the current user context to be a viewer.+ */+ public function asViewer()+ {+ return $this->actingAs($this->getViewer());+ }+/*** Get an instance of a user with 'viewer' permissions.*/