Comments management
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use crate::routes::get_max_page;
|
||||
use crate::routes::{COMMENTS_PER_PAGE, get_max_page};
|
||||
use crate::templates::PostsPageDashboardTemplate;
|
||||
use crate::{
|
||||
domain::PostEntry,
|
||||
routes::{
|
||||
AppError, Path, Query, fetch_comments_count, fetch_comments_page, get_comments_page_count,
|
||||
AppError, Path, Query, get_comments_count_for_post, get_comments_page_for_post,
|
||||
not_found_html,
|
||||
},
|
||||
startup::AppState,
|
||||
@@ -144,11 +144,11 @@ pub async fn see_post(
|
||||
.to_html()
|
||||
.context("Could not render markdown with extension.")?;
|
||||
let current_page = 1;
|
||||
let comments_count = fetch_comments_count(&connection_pool, post_id)
|
||||
let comments_count = get_comments_count_for_post(&connection_pool, post_id)
|
||||
.await
|
||||
.context("Could not fetch comment count")?;
|
||||
let max_page = get_comments_page_count(comments_count);
|
||||
let comments = fetch_comments_page(&connection_pool, post_id, 1)
|
||||
let max_page = get_max_page(comments_count, COMMENTS_PER_PAGE);
|
||||
let comments = get_comments_page_for_post(&connection_pool, post_id, 1)
|
||||
.await
|
||||
.context("Failed to fetch latest comments")?;
|
||||
let template = HtmlTemplate(PostTemplate {
|
||||
|
||||
Reference in New Issue
Block a user