1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

edit summary

This commit is contained in:
Younès EL BIACHE
2016-07-07 20:53:43 +02:00
parent 10418323ef
commit 6bc72e157a
7 changed files with 49 additions and 9 deletions

View File

@ -3,7 +3,7 @@
class PageRevision extends Model
{
protected $fillable = ['name', 'html', 'text', 'markdown'];
protected $fillable = ['name', 'html', 'text', 'markdown', 'summary'];
/**
* Get the user that created the page revision

View File

@ -310,7 +310,7 @@ class PageRepo extends EntityRepo
{
// Save a revision before updating
if ($page->html !== $input['html'] || $page->name !== $input['name']) {
$this->saveRevision($page);
$this->saveRevision($page, $input['summary']);
}
// Prevent slug being updated if no name change
@ -362,7 +362,7 @@ class PageRepo extends EntityRepo
* @param Page $page
* @return $this
*/
public function saveRevision(Page $page)
public function saveRevision(Page $page, $summary = null)
{
$revision = $this->pageRevision->fill($page->toArray());
if (setting('app-editor') !== 'markdown') $revision->markdown = '';
@ -372,6 +372,7 @@ class PageRepo extends EntityRepo
$revision->created_by = auth()->user()->id;
$revision->created_at = $page->updated_at;
$revision->type = 'version';
$revision->summary = $summary;
$revision->save();
// Clear old revisions
if ($this->pageRevision->where('page_id', '=', $page->id)->count() > 50) {