mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Fixed bug causing editing notification to always show
Updated tests to prevent happening again
This commit is contained in:
parent
a06321675a
commit
4656c12f6d
@ -498,6 +498,7 @@ class PageRepo extends EntityRepo
|
||||
private function activePageEditingQuery(Page $page, $minRange = null)
|
||||
{
|
||||
$query = $this->pageRevision->where('type', '=', 'update_draft')
|
||||
->where('page_id', '=', $page->id)
|
||||
->where('updated_at', '>', $page->updated_at)
|
||||
->where('created_by', '!=', auth()->user()->id)
|
||||
->with('createdBy');
|
||||
|
@ -48,6 +48,7 @@ class PageDraftTest extends TestCase
|
||||
|
||||
public function test_alert_message_shows_if_someone_else_editing()
|
||||
{
|
||||
$nonEditedPage = \BookStack\Page::take(10)->get()->last();
|
||||
$addedContent = '<p>test message content</p>';
|
||||
$this->asAdmin()->visit($this->page->getUrl() . '/edit')
|
||||
->dontSeeInField('html', $addedContent);
|
||||
@ -55,8 +56,13 @@ class PageDraftTest extends TestCase
|
||||
$newContent = $this->page->html . $addedContent;
|
||||
$newUser = $this->getNewUser();
|
||||
$this->pageRepo->saveUpdateDraft($this->page, ['html' => $newContent]);
|
||||
$this->actingAs($newUser)->visit($this->page->getUrl() . '/edit')
|
||||
|
||||
$this->actingAs($newUser)
|
||||
->visit($this->page->getUrl() . '/edit')
|
||||
->see('Admin has started editing this page');
|
||||
$this->flushSession();
|
||||
$this->visit($nonEditedPage->getUrl() . '/edit')
|
||||
->dontSeeInElement('.notification', 'Admin has started editing this page');
|
||||
}
|
||||
|
||||
public function test_draft_pages_show_on_homepage()
|
||||
|
Loading…
Reference in New Issue
Block a user