This commit is contained in:
spikecodes 2021-01-31 14:10:13 -08:00
parent 9a1733ac99
commit 971f14bb55
No known key found for this signature in database
GPG key ID: 004CECFF9B463BCB
2 changed files with 12 additions and 2 deletions

View file

@ -155,6 +155,8 @@ async fn parse_comments(json: &serde_json::Value) -> Vec<Comment> {
Vec::new()
};
dbg!();
comments.push(Comment {
id: val(&comment, "id"),
body,
@ -171,7 +173,11 @@ async fn parse_comments(json: &serde_json::Value) -> Vec<Comment> {
},
distinguished: val(&comment, "distinguished"),
},
score: format_num(score),
score: if comment["data"]["score_hidden"].as_bool().unwrap_or_default() {
"".to_string()
} else {
format_num(score)
},
rel_time,
created,
replies,

View file

@ -343,7 +343,11 @@ pub async fn fetch_posts(path: &str, fallback_title: String) -> Result<(Vec<Post
},
distinguished: val(post, "distinguished"),
},
score: format_num(score),
score: if post["data"]["hide_score"].as_bool().unwrap_or_default() {
"".to_string()
} else {
format_num(score)
},
upvote_ratio: ratio as i64,
post_type,
thumbnail: Media {