fix: user notification/request counts

This commit is contained in:
trisua 2025-07-26 22:28:45 -04:00
parent 29155ddb0c
commit 46e38042ce
4 changed files with 46 additions and 15 deletions

View file

@ -101,13 +101,9 @@ impl DataManager {
permissions: FinePermission::from_bits(get!(x->7(i32)) as u32).unwrap(),
is_verified: get!(x->8(i32)) as i8 == 1,
notification_count: {
let x = get!(x->9(i32));
if x > (usize::MAX - 1000) as i32 {
// we're a little too close to the maximum count, clearly something's gone wrong
0
} else {
x as usize
}
let x = get!(x->9(i32)) as usize;
// we're a little too close to the maximum count, clearly something's gone wrong
if x > usize::MAX - 1000 { 0 } else { x }
},
follower_count: get!(x->10(i32)) as usize,
following_count: get!(x->11(i32)) as usize,
@ -116,12 +112,8 @@ impl DataManager {
recovery_codes: serde_json::from_str(&get!(x->14(String)).to_string()).unwrap(),
post_count: get!(x->15(i32)) as usize,
request_count: {
let x = get!(x->16(i32));
if x > (usize::MAX - 1000) as i32 {
0
} else {
x as usize
}
let x = get!(x->16(i32)) as usize;
if x > usize::MAX - 1000 { 0 } else { x }
},
connections: serde_json::from_str(&get!(x->17(String)).to_string()).unwrap(),
stripe_id: get!(x->18(String)),