Create coll post with the provided slug, if exists
Closes T811
This commit is contained in:
parent
53ea85dc86
commit
2d38e8b65e
14
database.go
14
database.go
|
@ -638,13 +638,17 @@ func (db *datastore) CreatePost(userID, collID int64, post *SubmittedPost) (*Pos
|
||||||
ownerCollID.Int64 = collID
|
ownerCollID.Int64 = collID
|
||||||
ownerCollID.Valid = true
|
ownerCollID.Valid = true
|
||||||
var slugVal string
|
var slugVal string
|
||||||
if post.Title != nil && *post.Title != "" {
|
if post.Slug != nil && *post.Slug != "" {
|
||||||
slugVal = getSlug(*post.Title, post.Language.String)
|
slugVal = *post.Slug
|
||||||
if slugVal == "" {
|
} else {
|
||||||
|
if post.Title != nil && *post.Title != "" {
|
||||||
|
slugVal = getSlug(*post.Title, post.Language.String)
|
||||||
|
if slugVal == "" {
|
||||||
|
slugVal = getSlug(*post.Content, post.Language.String)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
slugVal = getSlug(*post.Content, post.Language.String)
|
slugVal = getSlug(*post.Content, post.Language.String)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
slugVal = getSlug(*post.Content, post.Language.String)
|
|
||||||
}
|
}
|
||||||
if slugVal == "" {
|
if slugVal == "" {
|
||||||
slugVal = friendlyID
|
slugVal = friendlyID
|
||||||
|
|
Loading…
Reference in New Issue