V2 #1
|
@ -47,6 +47,8 @@ let edit pgId : HttpHandler = requireUser >=> fun next ctx -> task {
|
|||
|
||||
open System
|
||||
|
||||
#nowarn "3511"
|
||||
|
||||
// POST /page/save
|
||||
let save : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
let! model = ctx.BindFormAsync<EditPageModel> ()
|
||||
|
@ -92,7 +94,7 @@ let save : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
|||
| Some r when r.text = revision.text -> page.revisions
|
||||
| _ -> revision :: page.revisions
|
||||
}
|
||||
do! (match model.pageId with "new" -> Data.Page.add | _ -> Data.Page.update) page conn
|
||||
do! (if model.pageId = "new" then Data.Page.add else Data.Page.update) page conn
|
||||
if updateList then do! PageListCache.update ctx
|
||||
do! addMessage ctx { UserMessage.success with message = "Page saved successfully" }
|
||||
return! redirectToGet $"/page/{PageId.toString page.id}/edit" next ctx
|
||||
|
|
|
@ -328,6 +328,8 @@ let edit postId : HttpHandler = requireUser >=> fun next ctx -> task {
|
|||
| None -> return! Error.notFound next ctx
|
||||
}
|
||||
|
||||
#nowarn "3511"
|
||||
|
||||
// POST /post/save
|
||||
let save : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
let! model = ctx.BindFormAsync<EditPostModel> ()
|
||||
|
@ -391,7 +393,7 @@ let save : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
|||
}
|
||||
| false -> { post with publishedOn = Some dt }
|
||||
| false -> post
|
||||
do! (match model.postId with "new" -> Data.Post.add | _ -> Data.Post.update) post conn
|
||||
do! (if model.postId = "new" then Data.Post.add else Data.Post.update) post conn
|
||||
// If the post was published or its categories changed, refresh the category cache
|
||||
if model.doPublish
|
||||
|| not (pst.Value.categoryIds
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
"hostname": "data02.bitbadger.solutions",
|
||||
"database": "myWebLog_dev"
|
||||
},
|
||||
"Generator": "myWebLog 2.0-alpha04"
|
||||
"Generator": "myWebLog 2.0-alpha05"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user