add comments to note on unlisted notes

This commit is contained in:
Peter Cai 2020-04-08 17:58:33 +08:00
parent b337306799
commit c68263a7bd
No known key found for this signature in database
GPG Key ID: 71F5FB4E4F3FD54F
2 changed files with 3 additions and 0 deletions

View File

@ -84,6 +84,8 @@ impl Post {
// post is not found in PostsList, it must not be found
// here either; if a post is found in PostsList, then
// this method should not return any error.
// (except for hidden posts, in which case they won't be
// present in PostsList)
pub async fn find_by_uuid(uuid: &str) -> MyResult<Post> {
store::get_obj(&Self::uuid_to_post_key(uuid)).await
}

View File

@ -34,6 +34,7 @@ async fn get_actions(_req: Request, url: Url) -> MyResult<Response> {
// Show different options depending on whether the post already exists
// Use Post here because PostsList is larger to read into memory
// also slower to check one-by-one
// (also, because it may be a hidden post that does not live in PostsList)
let post = match params.get("item_uuid") {
Some(uuid) => match blog::Post::find_by_uuid(&uuid).await {
Ok(post) => Some(post),