diff --git a/src/api/comment.rs b/src/api/comment.rs index 7f49402..4aeb5ee 100644 --- a/src/api/comment.rs +++ b/src/api/comment.rs @@ -31,7 +31,7 @@ pub struct CommentOutput { is_tmp: bool, create_time: i64, is_blocked: bool, - blocked_count: Option, + //blocked_count: Option, // for old version frontend timestamp: i64, blocked: bool, @@ -42,7 +42,7 @@ pub async fn c2output<'r>( cs: &[Comment], user: &CurrentUser, cached_block_dict: &HashMap, - rconn: &RdsConn, + //rconn: &RdsConn, ) -> Vec { let mut hash2id = HashMap::<&String, i32>::from([(&p.author_hash, 0)]); let name_ids_iter = cs.iter().map(|c| match hash2id.get(&c.author_hash) { @@ -69,6 +69,7 @@ pub async fn c2output<'r>( is_tmp: c.is_tmp, create_time: c.create_time.timestamp(), is_blocked, + /* blocked_count: if user.is_admin { BlockCounter::get_count(rconn, &c.author_hash) .await @@ -77,6 +78,7 @@ pub async fn c2output<'r>( } else { None }, + */ timestamp: c.create_time.timestamp(), blocked: is_blocked, }) @@ -99,7 +101,7 @@ pub async fn get_comment(pid: i32, user: CurrentUser, db: Db, rconn: RdsConn) -> let cached_block_dict = BlockDictCache::init(&user.namehash, p.id, &rconn) .get_or_create(&user, &hash_list) .await?; - let data = c2output(&p, &cs, &user, &cached_block_dict, &rconn).await; + let data = c2output(&p, &cs, &user, &cached_block_dict).await; Ok(json!({ "code": 0, diff --git a/src/api/post.rs b/src/api/post.rs index f0c247c..41f5db9 100644 --- a/src/api/post.rs +++ b/src/api/post.rs @@ -49,7 +49,7 @@ pub struct PostOutput { attention: bool, hot_score: Option, is_blocked: bool, - blocked_count: Option, + //blocked_count: Option, poll: Option, // for old version frontend timestamp: i64, @@ -98,19 +98,20 @@ async fn p2output(p: &Post, user: &CurrentUser, db: &Db, rconn: &RdsConn) -> Api is_tmp: p.is_tmp, is_reported: user.is_admin.then(|| p.is_reported), comments: OptionFuture::from( - comments - .map(|cs| async move { c2output(p, &cs, user, &cached_block_dict, rconn).await }), + comments.map(|cs| async move { c2output(p, &cs, user, &cached_block_dict).await }), ) .await, can_del: p.check_permission(user, "wd").is_ok(), attention: Attention::init(&user.namehash, rconn).has(p.id).await?, hot_score: user.is_admin.then(|| p.hot_score), is_blocked, + /* blocked_count: if user.is_admin { BlockCounter::get_count(rconn, &p.author_hash).await? } else { None }, + */ poll: if can_view { get_poll_dict(p.id, rconn, &user.namehash).await } else {