mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-30 07:32:39 +01:00
parent
37de4e2e0a
commit
a7e3c26fe3
@ -223,10 +223,6 @@ class PageRepo
|
||||
{
|
||||
$revision = new PageRevision($page->getAttributes());
|
||||
|
||||
if (setting('app-editor') !== 'markdown') {
|
||||
$revision->markdown = '';
|
||||
}
|
||||
|
||||
$revision->page_id = $page->id;
|
||||
$revision->slug = $page->slug;
|
||||
$revision->book_slug = $page->book->slug;
|
||||
@ -289,7 +285,13 @@ class PageRepo
|
||||
|
||||
$page->fill($revision->toArray());
|
||||
$content = new PageContent($page);
|
||||
$content->setNewHTML($revision->html);
|
||||
|
||||
if (!empty($revision->markdown)) {
|
||||
$content->setNewMarkdown($revision->markdown);
|
||||
} else {
|
||||
$content->setNewHTML($revision->html);
|
||||
}
|
||||
|
||||
$page->updated_by = user()->id;
|
||||
$page->refreshSlug();
|
||||
$page->save();
|
||||
|
@ -74,7 +74,7 @@ class PageRevisionTest extends TestCase
|
||||
$page = Page::first();
|
||||
$pageRepo->update($page, ['name' => 'updated page abc123', 'markdown' => '## New Content def456', 'summary' => 'initial page revision testing']);
|
||||
$pageRepo->update($page, ['name' => 'updated page again', 'markdown' => '## New Content Updated', 'summary' => 'page revision testing']);
|
||||
$page = Page::find($page->id);
|
||||
$page = Page::find($page->id);
|
||||
|
||||
$pageView = $this->get($page->getUrl());
|
||||
$pageView->assertDontSee('abc123');
|
||||
@ -90,7 +90,7 @@ class PageRevisionTest extends TestCase
|
||||
$pageView = $this->get($page->getUrl());
|
||||
$this->assertDatabaseHas('pages', [
|
||||
'id' => $page->id,
|
||||
'markdown' => '## New Content Updated',
|
||||
'markdown' => '## New Content def456',
|
||||
]);
|
||||
$pageView->assertSee('abc123');
|
||||
$pageView->assertSee('def456');
|
||||
|
Loading…
Reference in New Issue
Block a user