File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,8 @@ public function publishDraft(Page $draft, array $input): Page
77
77
$ this ->updateTemplateStatusAndContentFromInput ($ draft , $ input );
78
78
$ this ->baseRepo ->update ($ draft , $ input );
79
79
80
- $ this ->revisionRepo ->storeNewForPage ($ draft , trans ('entities.pages_initial_revision ' ));
80
+ $ summary = trim ($ input ['summary ' ] ?? '' ) ?: trans ('entities.pages_initial_revision ' );
81
+ $ this ->revisionRepo ->storeNewForPage ($ draft , $ summary );
81
82
$ draft ->refresh ();
82
83
83
84
Activity::add (ActivityType::PAGE_CREATE , $ draft );
Original file line number Diff line number Diff line change @@ -86,6 +86,32 @@ public function test_page_creation_with_markdown_content()
86
86
$ resp ->assertSee ('# a title ' );
87
87
}
88
88
89
+ public function test_page_creation_allows_summary_to_be_set ()
90
+ {
91
+ $ book = $ this ->entities ->book ();
92
+
93
+ $ this ->asEditor ()->get ($ book ->getUrl ('/create-page ' ));
94
+ $ draft = Page::query ()->where ('book_id ' , '= ' , $ book ->id )
95
+ ->where ('draft ' , '= ' , true )->first ();
96
+
97
+ $ details = [
98
+ 'html ' => '<h1>a title</h1> ' ,
99
+ 'name ' => 'My page with summary ' ,
100
+ 'summary ' => 'Here is my changelog message for a new page! ' ,
101
+ ];
102
+ $ resp = $ this ->post ($ book ->getUrl ("/draft/ {$ draft ->id }" ), $ details );
103
+ $ resp ->assertRedirect ();
104
+
105
+ $ this ->assertDatabaseHas ('page_revisions ' , [
106
+ 'page_id ' => $ draft ->id ,
107
+ 'summary ' => 'Here is my changelog message for a new page! ' ,
108
+ ]);
109
+
110
+ $ draft ->refresh ();
111
+ $ resp = $ this ->get ($ draft ->getUrl ('/revisions ' ));
112
+ $ resp ->assertSee ('Here is my changelog message for a new page! ' );
113
+ }
114
+
89
115
public function test_page_delete ()
90
116
{
91
117
$ page = $ this ->entities ->page ();
You can’t perform that action at this time.
0 commit comments