|
@@ -79,12 +79,21 @@ pub struct FCPDecorator {
|
|
|
pub initiating_comment_content: String,
|
|
|
}
|
|
|
|
|
|
+fn quote_reply(markdown: &str) -> String {
|
|
|
+ if markdown.is_empty() {
|
|
|
+ String::from("*No content*")
|
|
|
+ } else {
|
|
|
+ format!("\n\t> {}", markdown.replace("\n", "\n\t> "))
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
impl FCPDecorator {
|
|
|
pub fn from_issue_fcp(
|
|
|
full_fcp: &FullFCP,
|
|
|
issue_decorator: &crate::actions::IssueDecorator,
|
|
|
) -> Self {
|
|
|
Self {
|
|
|
+ // shared properties with IssueDecorator
|
|
|
number: issue_decorator.number.clone(),
|
|
|
title: issue_decorator.title.clone(),
|
|
|
html_url: issue_decorator.html_url.clone(),
|
|
@@ -93,18 +102,19 @@ impl FCPDecorator {
|
|
|
assignees: issue_decorator.assignees.clone(),
|
|
|
updated_at: issue_decorator.updated_at.clone(),
|
|
|
|
|
|
+ // additional properties from FullFCP (from rfcbot)
|
|
|
bot_tracking_comment: full_fcp.fcp.fk_bot_tracking_comment.to_string(),
|
|
|
bot_tracking_comment_html_url: format!(
|
|
|
"{}#issuecomment-{}",
|
|
|
issue_decorator.html_url, full_fcp.fcp.fk_bot_tracking_comment
|
|
|
),
|
|
|
- bot_tracking_comment_content: String::new(), // TODO: get from GitHub
|
|
|
+ bot_tracking_comment_content: quote_reply(&full_fcp.status_comment.body),
|
|
|
initiating_comment: full_fcp.fcp.fk_initiating_comment.to_string(),
|
|
|
initiating_comment_html_url: format!(
|
|
|
"{}#issuecomment-{}",
|
|
|
issue_decorator.html_url, full_fcp.fcp.fk_initiating_comment
|
|
|
),
|
|
|
- initiating_comment_content: full_fcp.status_comment.body.clone(),
|
|
|
+ initiating_comment_content: quote_reply(&String::new()), // TODO: get from GitHub
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -117,11 +127,6 @@ pub async fn get_all_fcps() -> anyhow::Result<HashMap<String, FullFCP>> {
|
|
|
let mut map: HashMap<String, FullFCP> = HashMap::new();
|
|
|
for full_fcp in res.into_iter() {
|
|
|
map.insert(
|
|
|
- // format!(
|
|
|
- // "https://github.com/{}/pulls/{}",
|
|
|
- // full_fcp.issue.repository.clone(),
|
|
|
- // full_fcp.issue.number.clone()
|
|
|
- // ),
|
|
|
format!(
|
|
|
"{}:{}:{}",
|
|
|
full_fcp.issue.repository.clone(),
|