diff --git a/homu/parse_issue_comment.py b/homu/parse_issue_comment.py index d53c2ea..e43133f 100644 --- a/homu/parse_issue_comment.py +++ b/homu/parse_issue_comment.py @@ -151,7 +151,14 @@ def parse_issue_comment(username, body, sha, botname, hooks=[]): E.g. `['hook1', 'hook2', 'hook3']` """ - words = list(chain.from_iterable(re.findall(r'\S+', x) for x in body.splitlines() if '@' + botname in x)) # noqa + botname_regex = re.compile(r'^.*(?=@' + botname + ')') + + # All of the 'words' after and including the botname + words = list(chain.from_iterable( + re.findall(r'\S+', re.sub(botname_regex, '', x)) + for x + in body.splitlines() + if '@' + botname in x)) # noqa commands = [] diff --git a/homu/tests/test_parse_issue_comment.py b/homu/tests/test_parse_issue_comment.py index 5525b26..e7e475a 100644 --- a/homu/tests/test_parse_issue_comment.py +++ b/homu/tests/test_parse_issue_comment.py @@ -52,6 +52,22 @@ def test_r_equals(): assert command.actor == 'jill' +def test_hidden_r_equals(): + author = "bors" + body = """ + :pushpin: Commit {0} has been approved by `jack` + + """.format(commit) + + commands = parse_issue_comment(author, body, commit, "bors") + + assert len(commands) == 1 + command = commands[0] + assert command.action == 'approve' + assert command.actor == 'jack' + assert command.commit == commit + + def test_r_me(): """ Ignore r=me