@@ -57,13 +57,13 @@ const schema = {
57
57
canUpdate : [ 'admins' ] ,
58
58
input : 'datetime' ,
59
59
group : formGroups . admin ,
60
- onCreate : ( { document : post , currentUser} ) => {
60
+ onCreate : ( { newDocument : post , currentUser} ) => {
61
61
// Set the post's postedAt if it's going to be approved
62
62
if ( ! post . postedAt && getCollection ( 'Posts' ) . getDefaultStatus ( currentUser ) === getCollection ( 'Posts' ) . config . STATUS_APPROVED ) {
63
63
return new Date ( ) ;
64
64
}
65
65
} ,
66
- onUpdate : ( { data, post} ) => {
66
+ onUpdate : ( { data, document : post } ) => {
67
67
// Set the post's postedAt if it's going to be approved
68
68
if ( ! post . postedAt && data . status === getCollection ( 'Posts' ) . config . STATUS_APPROVED ) {
69
69
return new Date ( ) ;
@@ -111,7 +111,7 @@ const schema = {
111
111
type : String ,
112
112
optional : true ,
113
113
canRead : [ 'guests' ] ,
114
- onCreate : ( { post} ) => {
114
+ onCreate : ( { newDocument : post } ) => {
115
115
return Utils . slugify ( post . title ) ;
116
116
} ,
117
117
onUpdate : ( { data} ) => {
@@ -140,7 +140,7 @@ const schema = {
140
140
type : String ,
141
141
optional : true ,
142
142
canRead : [ 'guests' ] ,
143
- onCreate : ( { post} ) => {
143
+ onCreate : ( { newDocument : post } ) => {
144
144
if ( post . body ) {
145
145
return Utils . sanitize ( marked ( post . body ) ) ;
146
146
}
@@ -159,7 +159,7 @@ const schema = {
159
159
optional : true ,
160
160
canRead : [ 'guests' ] ,
161
161
searchable : true ,
162
- onCreate : ( { post} ) => {
162
+ onCreate : ( { newDocument : post } ) => {
163
163
if ( post . body ) {
164
164
// excerpt length is configurable via the settings (30 words by default, ~255 characters)
165
165
const excerptLength = getSetting ( 'forum.postExcerptLength' , 30 ) ;
@@ -209,7 +209,7 @@ const schema = {
209
209
canCreate : [ 'admins' ] ,
210
210
canUpdate : [ 'admins' ] ,
211
211
input : 'select' ,
212
- onCreate : ( { document, currentUser} ) => {
212
+ onCreate : ( { newDocument : document , currentUser} ) => {
213
213
if ( ! document . status ) {
214
214
return getCollection ( 'Posts' ) . getDefaultStatus ( currentUser ) ;
215
215
}
@@ -230,15 +230,15 @@ const schema = {
230
230
type : Boolean ,
231
231
optional : true ,
232
232
canRead : [ 'guests' ] ,
233
- onCreate : ( { post} ) => {
233
+ onCreate : ( { newDocument : post } ) => {
234
234
// Set the post's isFuture to true if necessary
235
235
if ( post . postedAt ) {
236
236
const postTime = new Date ( post . postedAt ) . getTime ( ) ;
237
237
const currentTime = new Date ( ) . getTime ( ) + 1000 ;
238
238
return postTime > currentTime ; // round up to the second
239
239
}
240
240
} ,
241
- onUpdate : ( { data, post} ) => {
241
+ onUpdate : ( { data, document : post } ) => {
242
242
// Set the post's isFuture to true if necessary
243
243
if ( data . postedAt ) {
244
244
const postTime = new Date ( data . postedAt ) . getTime ( ) ;
@@ -265,7 +265,7 @@ const schema = {
265
265
canUpdate : [ 'admins' ] ,
266
266
input : 'checkbox' ,
267
267
group : formGroups . admin ,
268
- onCreate : ( { post} ) => {
268
+ onCreate : ( { newDocument : post } ) => {
269
269
if ( ! post . sticky ) {
270
270
return false ;
271
271
}
0 commit comments