strikethrough completed PRs
This commit is contained in:
parent
7b131d8b6b
commit
7ef8b43102
@ -17,6 +17,14 @@ pub struct PullRequestRef {
|
||||
sha: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
pub enum PullRequestStatus {
|
||||
#[serde(rename = "open")]
|
||||
Open,
|
||||
#[serde(rename = "closed")]
|
||||
Closed
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
pub struct PullRequest {
|
||||
id: usize,
|
||||
@ -26,6 +34,7 @@ pub struct PullRequest {
|
||||
title: String,
|
||||
url: String,
|
||||
body: String,
|
||||
state: PullRequestStatus
|
||||
}
|
||||
|
||||
impl PullRequest {
|
||||
@ -44,8 +53,12 @@ impl PullRequest {
|
||||
pub fn number(&self) -> usize {
|
||||
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 {
|
||||
|
@ -8,7 +8,7 @@ use crate::api::search::PullRequest;
|
||||
|
||||
fn process(row: String) -> String {
|
||||
// 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()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user