NOW MANAGED ON CODEBERG
Fixed bug causing editing notification to always show
Dan Brown4656c12f6daf
diff --git a/app/Repos/PageRepo.php b/app/Repos/PageRepo.phpindex 547f3e4a6..4c3512fa7 100644--- a/app/Repos/PageRepo.php+++ b/app/Repos/PageRepo.php@@ -498,6 +498,7 @@ class PageRepo extends EntityRepoprivate 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');diff --git a/tests/Entity/PageDraftTest.php b/tests/Entity/PageDraftTest.phpindex 218b458bd..2c9a28814 100644--- a/tests/Entity/PageDraftTest.php+++ b/tests/Entity/PageDraftTest.php@@ -48,6 +48,7 @@ class PageDraftTest extends TestCasepublic 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()