strikethrough completed PRs
This commit is contained in:
parent
7b131d8b6b
commit
7ef8b43102
@ -17,6 +17,14 @@ pub struct PullRequestRef {
|
|||||||
sha: String,
|
sha: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
pub enum PullRequestStatus {
|
||||||
|
#[serde(rename = "open")]
|
||||||
|
Open,
|
||||||
|
#[serde(rename = "closed")]
|
||||||
|
Closed
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
pub struct PullRequest {
|
pub struct PullRequest {
|
||||||
id: usize,
|
id: usize,
|
||||||
@ -26,6 +34,7 @@ pub struct PullRequest {
|
|||||||
title: String,
|
title: String,
|
||||||
url: String,
|
url: String,
|
||||||
body: String,
|
body: String,
|
||||||
|
state: PullRequestStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PullRequest {
|
impl PullRequest {
|
||||||
@ -44,8 +53,12 @@ impl PullRequest {
|
|||||||
pub fn number(&self) -> usize {
|
pub fn number(&self) -> usize {
|
||||||
self.number
|
self.number
|
||||||
}
|
}
|
||||||
pub fn title(&self) -> &str {
|
|
||||||
&self.title
|
pub fn title(&self) -> String {
|
||||||
|
match &self.state {
|
||||||
|
PullRequestStatus::Open => self.title.to_owned(),
|
||||||
|
PullRequestStatus::Closed => format!("~~{}~~", &self.title.trim())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn body(&self) -> &str {
|
pub fn body(&self) -> &str {
|
||||||
|
@ -8,7 +8,7 @@ use crate::api::search::PullRequest;
|
|||||||
|
|
||||||
fn process(row: String) -> String {
|
fn process(row: String) -> String {
|
||||||
// TODO: Make this configurable
|
// TODO: Make this configurable
|
||||||
let regex = Regex::new(r"\[HEAP-\d+\]").unwrap();
|
let regex = Regex::new(r"\[HEAP-\d+\]\s*").unwrap();
|
||||||
regex.replace_all(&row, "").into_owned()
|
regex.replace_all(&row, "").into_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user