Add tests for OpenGraph view model properties

This commit is contained in:
2025-07-26 20:33:30 -04:00
parent e33966b3df
commit 8b190a6c23
4 changed files with 267 additions and 41 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ let save : HttpHandler = requireAccess Author >=> fun next ctx -> task {
match! tryPage with
| Some page when canEdit page.AuthorId ctx ->
let updateList = page.IsInPageList <> model.IsShownInPageList
let updatedPage = model.UpdatePage page now
let updatedPage = model.UpdatePage page ctx.WebLog now
do! (if model.IsNew then data.Page.Add else data.Page.Update) updatedPage
if updateList then do! PageListCache.update ctx
do! addMessage ctx { UserMessage.Success with Message = "Page saved successfully" }
+2 -2
View File
@@ -157,7 +157,7 @@ let pageOfTaggedPosts slugAndPage : HttpHandler = fun next ctx -> task {
let webLog = ctx.WebLog
let data = ctx.Data
match parseSlugAndPage webLog slugAndPage with
| Some pageNbr, rawTag, isFeed ->
| Some pageNbr, rawTag, isFeed ->
let urlTag = HttpUtility.UrlDecode rawTag
let! tag = backgroundTask {
match! data.TagMap.FindByUrlValue urlTag webLog.Id with
@@ -495,7 +495,7 @@ let save : HttpHandler = requireAccess Author >=> fun next ctx -> task {
| Some post when canEdit post.AuthorId ctx ->
let priorCats = post.CategoryIds
let updatedPost =
model.UpdatePost post (Noda.now ())
model.UpdatePost post ctx.WebLog (Noda.now ())
|> function
| post ->
if model.SetPublished then