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