mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-15 07:43:31 +08:00
Revisions: Hid changes link for oldest revision
Just as a UX improvement to help avoid confusion, as the whole content will be changes for this revision. For #5454
This commit is contained in:
parent
4f5ad171ac
commit
dfbc78947f
@ -43,7 +43,6 @@ class PageRevisionController extends Controller
|
||||
->selectRaw("IF(markdown = '', false, true) as is_markdown")
|
||||
->with(['page.book', 'createdBy'])
|
||||
->reorder('id', $listOptions->getOrder())
|
||||
->reorder('created_at', $listOptions->getOrder())
|
||||
->paginate(50);
|
||||
|
||||
$this->setPageTitle(trans('entities.pages_revisions_named', ['pageName' => $page->getShortName()]));
|
||||
@ -52,6 +51,7 @@ class PageRevisionController extends Controller
|
||||
'revisions' => $revisions,
|
||||
'page' => $page,
|
||||
'listOptions' => $listOptions,
|
||||
'oldestRevisionId' => $page->revisions()->min('id'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,10 @@
|
||||
{{ $revision->summary }}
|
||||
</div>
|
||||
<div class="flex-2 px-m py-xs actions text-small text-l-right min-width-l">
|
||||
<a href="{{ $revision->getUrl('changes') }}" target="_blank" rel="noopener">{{ trans('entities.pages_revisions_changes') }}</a>
|
||||
<span class="text-muted opacity-70"> | </span>
|
||||
@if(!$oldest)
|
||||
<a href="{{ $revision->getUrl('changes') }}" target="_blank" rel="noopener">{{ trans('entities.pages_revisions_changes') }}</a>
|
||||
<span class="text-muted opacity-70"> | </span>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($current)
|
||||
|
@ -37,7 +37,11 @@
|
||||
<div class="flex-2 px-m py-xs text-right">{{ trans('common.actions') }}</div>
|
||||
</div>
|
||||
@foreach($revisions as $index => $revision)
|
||||
@include('pages.parts.revisions-index-row', ['revision' => $revision, 'current' => $page->revision_count === $revision->revision_number])
|
||||
@include('pages.parts.revisions-index-row', [
|
||||
'revision' => $revision,
|
||||
'current' => $page->revision_count === $revision->revision_number,
|
||||
'oldest' => $oldestRevisionId === $revision->id,
|
||||
])
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
|
@ -203,6 +203,18 @@ class PageRevisionTest extends TestCase
|
||||
$this->withHtml($resp)->assertElementContains('.item-list-row > div:nth-child(2)', 'Markdown)');
|
||||
}
|
||||
|
||||
public function test_revision_changes_link_not_shown_for_oldest_revision()
|
||||
{
|
||||
$page = $this->entities->page();
|
||||
$this->createRevisions($page, 3, ['html' => 'new page html']);
|
||||
|
||||
$resp = $this->asAdmin()->get($page->refresh()->getUrl('/revisions'));
|
||||
$html = $this->withHtml($resp);
|
||||
|
||||
$html->assertElementNotExists('.item-list > .item-list-row:last-child a[href*="/changes"]');
|
||||
$html->assertElementContains('.item-list > .item-list-row:nth-child(2)', 'Changes');
|
||||
}
|
||||
|
||||
public function test_revision_restore_action_only_visible_with_permission()
|
||||
{
|
||||
$page = $this->entities->page();
|
||||
|
Loading…
x
Reference in New Issue
Block a user