mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Updated page revisions link visibility
To match the actual visibilities of the revisions listing page and options. Related to #2946
This commit is contained in:
parent
9158a66bff
commit
2fe261e207
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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();
|
||||
|
@ -89,6 +89,14 @@ abstract class TestCase extends BaseTestCase
|
||||
return $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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user