Browse Source

introduce template changes for _issues_fcps.tt

chaz-kiker 3 years ago
parent
commit
0e84825a60
3 changed files with 304 additions and 285 deletions
  1. 285 277
      SomeFile.txt
  2. 12 7
      src/rfcbot.rs
  3. 7 1
      templates/_issues_fcps.tt

File diff suppressed because it is too large
+ 285 - 277
SomeFile.txt


+ 12 - 7
src/rfcbot.rs

@@ -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(),

+ 7 - 1
templates/_issues_fcps.tt

@@ -4,7 +4,13 @@
 {%- for issue in issues %}
 {{heading}} "{{issue.title}}" {{issue.repo_name}}#{{issue.number}}
 
-**Link:** {{issue.html_url}}
+- **Link:** {{issue.html_url}}
+- [**Tracking Comment**]({{issue.bot_tracking_comment_html_url}}): {{issue.bot_tracking_comment_content}}
+- [**Initiating Comment**]({{issue.initiating_comment_html_url}}): {{issue.initiating_comment_content}}
+
+
+
+
 {%else%}
 
 None.

Some files were not shown because too many files changed in this diff