diff --git a/src/api/operation.rs b/src/api/operation.rs index 8772106..7ff956f 100644 --- a/src/api/operation.rs +++ b/src/api/operation.rs @@ -182,7 +182,9 @@ pub async fn block(bi: Form, user: CurrentUser, db: Db, rconn: RdsCo let curr = if blk.add(&nh_to_block).await? > 0 { BlockCounter::count_incr(&rconn, &nh_to_block).await? } else { - 114514 + BlockCounter::get_count(&rconn, &nh_to_block) + .await? + .unwrap_or_default() }; BlockDictCache::init(&user.namehash, pid, &rconn) diff --git a/src/rds_models.rs b/src/rds_models.rs index da6be76..bbb2199 100644 --- a/src/rds_models.rs +++ b/src/rds_models.rs @@ -241,7 +241,7 @@ impl BlockedUsers { pub struct BlockCounter; impl BlockCounter { - pub async fn count_incr(rconn: &RdsConn, namehash: &str) -> RedisResult { + pub async fn count_incr(rconn: &RdsConn, namehash: &str) -> RedisResult { rconn.clone().hincr(KEY_BLOCKED_COUNTER, namehash, 1).await }