V2 #1
|
@ -380,16 +380,19 @@ module Page =
|
||||||
|> tryFirst
|
|> tryFirst
|
||||||
|
|
||||||
/// Find the current permalink for a page by a prior permalink
|
/// Find the current permalink for a page by a prior permalink
|
||||||
let findCurrentPermalink (permalinks : Permalink list) (webLogId : WebLogId) =
|
let findCurrentPermalink (permalinks : Permalink list) (webLogId : WebLogId) conn = backgroundTask {
|
||||||
rethink<Permalink list> {
|
let! result =
|
||||||
withTable Table.Page
|
(rethink<Page list> {
|
||||||
getAll (objList permalinks) "priorPermalinks"
|
withTable Table.Page
|
||||||
filter "webLogId" webLogId
|
getAll (objList permalinks) "priorPermalinks"
|
||||||
pluck [ "permalink" ]
|
filter "webLogId" webLogId
|
||||||
limit 1
|
without [ "revisions"; "text" ]
|
||||||
result; withRetryDefault
|
limit 1
|
||||||
}
|
result; withRetryDefault
|
||||||
|> tryFirst
|
}
|
||||||
|
|> tryFirst) conn
|
||||||
|
return result |> Option.map (fun pg -> pg.permalink)
|
||||||
|
}
|
||||||
|
|
||||||
/// Find all pages in the page list for the given web log
|
/// Find all pages in the page list for the given web log
|
||||||
let findListed (webLogId : WebLogId) =
|
let findListed (webLogId : WebLogId) =
|
||||||
|
@ -506,16 +509,19 @@ module Post =
|
||||||
|> verifyWebLog webLogId (fun p -> p.webLogId)
|
|> verifyWebLog webLogId (fun p -> p.webLogId)
|
||||||
|
|
||||||
/// Find the current permalink for a post by a prior permalink
|
/// Find the current permalink for a post by a prior permalink
|
||||||
let findCurrentPermalink (permalinks : Permalink list) (webLogId : WebLogId) =
|
let findCurrentPermalink (permalinks : Permalink list) (webLogId : WebLogId) conn = backgroundTask {
|
||||||
rethink<Permalink list> {
|
let! result =
|
||||||
withTable Table.Post
|
(rethink<Post list> {
|
||||||
getAll (objList permalinks) "priorPermalinks"
|
withTable Table.Post
|
||||||
filter "webLogId" webLogId
|
getAll (objList permalinks) "priorPermalinks"
|
||||||
pluck [ "permalink" ]
|
filter "webLogId" webLogId
|
||||||
limit 1
|
without [ "revisions"; "text" ]
|
||||||
result; withRetryDefault
|
limit 1
|
||||||
}
|
result; withRetryDefault
|
||||||
|> tryFirst
|
}
|
||||||
|
|> tryFirst) conn
|
||||||
|
return result |> Option.map (fun post -> post.permalink)
|
||||||
|
}
|
||||||
|
|
||||||
/// Find posts to be displayed on a category list page
|
/// Find posts to be displayed on a category list page
|
||||||
let findPageOfCategorizedPosts (webLogId : WebLogId) (catIds : CategoryId list) (pageNbr : int64) postsPerPage =
|
let findPageOfCategorizedPosts (webLogId : WebLogId) (catIds : CategoryId list) (pageNbr : int64) postsPerPage =
|
||||||
|
|
|
@ -302,7 +302,7 @@ let private deriveAction ctx : HttpHandler seq =
|
||||||
match Data.Post.findCurrentPermalink [ permalink; altLink ] webLog.id conn |> await with
|
match Data.Post.findCurrentPermalink [ permalink; altLink ] webLog.id conn |> await with
|
||||||
| Some link -> yield redirectTo true $"/{Permalink.toString link}"
|
| Some link -> yield redirectTo true $"/{Permalink.toString link}"
|
||||||
| None -> ()
|
| None -> ()
|
||||||
// Prior permalink
|
// Prior page
|
||||||
match Data.Page.findCurrentPermalink [ permalink; altLink ] webLog.id conn |> await with
|
match Data.Page.findCurrentPermalink [ permalink; altLink ] webLog.id conn |> await with
|
||||||
| Some link -> yield redirectTo true $"/{Permalink.toString link}"
|
| Some link -> yield redirectTo true $"/{Permalink.toString link}"
|
||||||
| None -> ()
|
| None -> ()
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
"hostname": "data02.bitbadger.solutions",
|
"hostname": "data02.bitbadger.solutions",
|
||||||
"database": "myWebLog_dev"
|
"database": "myWebLog_dev"
|
||||||
},
|
},
|
||||||
"Generator": "myWebLog 2.0-alpha06"
|
"Generator": "myWebLog 2.0-alpha08"
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
value="{{ model.permalink }}">
|
value="{{ model.permalink }}">
|
||||||
<label for="permalink">Permalink</label>
|
<label for="permalink">Permalink</label>
|
||||||
{%- if model.page_id != "new" %}
|
{%- if model.page_id != "new" %}
|
||||||
<span class="form-text"><a href="/page/{{ model.page_id }}/permalinks">Manage Permalinks</a></span>
|
<span class="form-text"><a href="/admin/page/{{ model.page_id }}/permalinks">Manage Permalinks</a></span>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
value="{{ model.permalink }}">
|
value="{{ model.permalink }}">
|
||||||
<label for="permalink">Permalink</label>
|
<label for="permalink">Permalink</label>
|
||||||
{%- if model.page_id != "new" %}
|
{%- if model.page_id != "new" %}
|
||||||
<span class="form-text"><a href="/post/{{ model.post_id }}/permalinks">Manage Permalinks</a></span>
|
<span class="form-text"><a href="/admin/post/{{ model.post_id }}/permalinks">Manage Permalinks</a></span>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user