aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2024-07-30 17:05:43 +0200
committerGitHub <noreply@github.com>2024-07-30 17:05:43 +0200
commited1488f5e96a07da61f60ff8af931be5af62b48a (patch)
tree781dab13544f701e446e0032cefbb539cbf7b8a3 /src-tauri/src
parentbaffc20eb6a3439a9475fc088e731d46b561072c (diff)
downloadFlightCore-ed1488f5e96a07da61f60ff8af931be5af62b48a.tar.gz
FlightCore-ed1488f5e96a07da61f60ff8af931be5af62b48a.zip
feat: Show pull request labels in PR view (#985)
to more easily see which PRs need testing etc
Diffstat (limited to 'src-tauri/src')
-rw-r--r--src-tauri/src/github/pull_requests.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src-tauri/src/github/pull_requests.rs b/src-tauri/src/github/pull_requests.rs
index 7e400c1a..de733feb 100644
--- a/src-tauri/src/github/pull_requests.rs
+++ b/src-tauri/src/github/pull_requests.rs
@@ -32,6 +32,7 @@ pub struct PullsApiResponseElement {
url: String,
head: CommitHead,
html_url: String,
+ labels: Vec<String>,
}
// GitHub API response JSON elements as structs
@@ -102,6 +103,14 @@ pub async fn get_pull_requests(
repo,
};
+ // Get labels and their names and put the into vector
+ let label_names: Vec<String> = item
+ .labels
+ .unwrap_or_else(Vec::new)
+ .into_iter()
+ .map(|label| label.name)
+ .collect();
+
// TODO there's probably a way to automatically serialize into the struct but I don't know yet how to
let elem = PullsApiResponseElement {
number: item.number,
@@ -112,6 +121,7 @@ pub async fn get_pull_requests(
.html_url
.ok_or(anyhow!("html_url not found"))?
.to_string(),
+ labels: label_names,
};
all_pull_requests.push(elem);