Skip to content

Commit

Permalink
add logs for comments error
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Busch committed Mar 27, 2023
1 parent 55dd93c commit 5ee5506
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Empty file removed src/api/comment.rs
Empty file.
3 changes: 3 additions & 0 deletions src/api/fetch_github_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ pub async fn get_github_response(username: &str, access_token: &str, status: &st
if item.state == "open" {
let comments_url = &item.comments_url;
let comments_response = client.get(comments_url).send().await?;
if !comments_response.status().is_success() {
println!("Error: {}", comments_response.status());
}
let comments_json: Vec<IssueComments> = comments_response.json().await?;
item.comments_list = comments_json;
}
Expand Down
16 changes: 8 additions & 8 deletions src/render_items/render_issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ pub fn render_issues<'a>(issues: &Vec<ApiResponseItem>, selected_issue_index: Op

if show_comment == true {
let comments_text: Vec<String> = selected_issue
.comments_list
.iter()
.filter(|comment| comment.user.login != "netlify[bot]" && comment.user.login != "gatsby-cloud[bot]" )
.map(|comment| {
let formatted_body = wrap(&comment.body, body_width).join("\n");
format!("{}: {}", comment.user.login, formatted_body)
})
.collect();
.comments_list
.iter()
.filter(|comment| comment.user.login != "netlify[bot]" && comment.user.login != "gatsby-cloud[bot]" )
.map(|comment| {
let formatted_body = wrap(&comment.body, body_width).join("\n");
format!("{}: {}", comment.user.login, formatted_body)
})
.collect();
let comments_cell;
if comments_text.len() == 0 {
comments_cell = Cell::from("No comments");
Expand Down

0 comments on commit 5ee5506

Please sign in to comment.