Skip to content

Commit

Permalink
fix: replace emoji shortcodes everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
cococonscious committed Sep 17, 2024
1 parent 626375d commit e06c237
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lib/answers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ fn get_summary(
/// If there is a referenced issue, we want to return a new string
/// appending it to the body. If not, just give back the body
fn get_amended_body(body: &Option<String>, issue_reference: &Option<String>) -> Option<String> {
match (body, issue_reference) {
let body = match (body, issue_reference) {
(Some(body), Some(issue_reference)) => Some(format!("{body}\n\n{issue_reference}")),
(Some(body), None) => Some(body.into()),
(None, Some(issue_reference)) => Some(issue_reference.to_owned()),
(None, None) => None,
};
if body.is_some() {
Some(body?.replace_emoji_shortcodes())
} else {
None
}
}

Expand All @@ -51,9 +56,14 @@ pub struct ExtractedAnswers {
/// Extract the prompt answers into an `ExtractedAnswers`,
/// making it usable for creating a commit
pub fn get_extracted_answers(answers: Answers, config: &Config) -> Result<ExtractedAnswers> {
let scope = match answers.scope {
Some(scope) => Some(scope.replace_emoji_shortcodes()),
None => None,
};

Ok(ExtractedAnswers {
commit_type: answers.commit_type.clone(),
scope: answers.scope,
scope,
summary: get_summary(
&answers.summary,
config.emoji,
Expand Down

0 comments on commit e06c237

Please sign in to comment.