Skip to content

Commit de15a03

Browse files
authored
Merge pull request #2090 from Urgau/support-concern-resolve
Also support `concern resolve` to resolve concerns
2 parents 96e3ca8 + e6afe60 commit de15a03

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

parser/src/command.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,18 @@ fn concern() {
374374
);
375375
}
376376

377+
#[test]
378+
fn concern_resolve() {
379+
let input = "@bot concern resolve this is my concern";
380+
let mut input = Input::new(input, vec!["bot"]);
381+
assert_eq!(
382+
input.next(),
383+
Some(Command::Concern(Ok(concern::ConcernCommand::Resolve {
384+
title: "this is my concern".to_string()
385+
})))
386+
);
387+
}
388+
377389
#[test]
378390
fn resolve() {
379391
let input = "@bot resolve this is my concern";

parser/src/command/concern.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,16 @@ impl fmt::Display for ParseError {
2525
impl ConcernCommand {
2626
pub fn parse<'a>(input: &mut Tokenizer<'a>) -> Result<Option<Self>, Error<'a>> {
2727
let mut toks = input.clone();
28-
if let Some(Token::Word(action @ ("concern" | "resolve"))) = toks.peek_token()? {
28+
if let Some(Token::Word(mut action @ ("concern" | "resolve"))) = toks.peek_token()? {
2929
toks.next_token()?;
3030

31+
if action == "concern" {
32+
if let Some(Token::Word(sub_action @ "resolve")) = toks.peek_token()? {
33+
toks.next_token()?;
34+
action = sub_action;
35+
}
36+
}
37+
3138
let title = toks.take_line()?.trim().to_string();
3239

3340
if title.is_empty() {

0 commit comments

Comments
 (0)