Add slug to drafts because uploading media needs slug
This commit is contained in:
parent
7b537e3d4e
commit
6fbb51eb63
|
@ -627,7 +627,12 @@ func (db *datastore) CreatePost(userID, collID int64, post *SubmittedPost) (*Pos
|
|||
ownerCollID := sql.NullInt64{
|
||||
Valid: false,
|
||||
}
|
||||
slug := sql.NullString{"", false}
|
||||
slugString := *post.Slug
|
||||
slugValid := true
|
||||
if slugString == "" {
|
||||
slugValid = false
|
||||
}
|
||||
slug := sql.NullString{slugString, slugValid}
|
||||
|
||||
// If an alias was supplied, we'll add this to the collection as well.
|
||||
if userID > 0 {
|
||||
|
|
2
posts.go
2
posts.go
|
@ -635,6 +635,8 @@ func newPost(app *App, w http.ResponseWriter, r *http.Request) error {
|
|||
}
|
||||
collID = coll.ID
|
||||
}
|
||||
slug := getSlugFromPost(*p.Title, *p.Content, p.Language.String)
|
||||
p.Slug = &slug
|
||||
// TODO: return PublicPost from createPost
|
||||
newPost.Post, err = app.db.CreatePost(userID, collID, p)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue