Fixed issue where updated page content would not be indexed

- Also updated html field of pages to not be fillable.
   (Since HTML should always go through app id parsing)

Related to #2042
This commit is contained in:
Dan Brown 2020-05-23 00:46:13 +01:00
parent b61f950560
commit 00c0815808
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
3 changed files with 19 additions and 4 deletions

View File

@ -21,7 +21,7 @@ use Permissions;
*/
class Page extends BookChild
{
protected $fillable = ['name', 'html', 'priority', 'markdown'];
protected $fillable = ['name', 'priority', 'markdown'];
protected $simpleAttributes = ['name', 'id', 'slug'];

View File

@ -180,12 +180,11 @@ class PageRepo
$page->template = ($input['template'] === 'true');
}
$pageContent = new PageContent($page);
$pageContent->setNewHTML($input['html']);
$this->baseRepo->update($page, $input);
// Update with new details
$page->fill($input);
$pageContent = new PageContent($page);
$pageContent->setNewHTML($input['html']);
$page->revision_count++;
if (setting('app-editor') !== 'markdown') {

View File

@ -277,4 +277,20 @@ class EntitySearchTest extends TestCase
$search->assertSee($expectedShelf->name);
}
}
public function test_search_works_on_updated_page_content()
{
$page = Page::query()->first();
$this->asEditor();
$update = $this->put($page->getUrl(), [
'name' => $page->name,
'html' => '<p>dog pandabearmonster spaghetti</p>',
]);
$search = $this->asEditor()->get('/search?term=pandabearmonster');
$search->assertStatus(200);
$search->assertSeeText($page->name);
$search->assertSee($page->getUrl());
}
}