Skip to content

Commit

Permalink
Fix #66
Browse files Browse the repository at this point in the history
  • Loading branch information
spikecodes committed Jan 31, 2021
1 parent 9a1733a commit 971f14b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 971f14b

Please sign in to comment.