File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -266,9 +266,27 @@ def process_short_ref(issue_reference):
266266
267267 return m .group (1 ), m .group (2 ), m .group (3 )
268268
269+ # Super short issue reference (e.g. `#1234`)
270+ def process_super_short_ref (issue_reference ):
271+ issue_rgx = r'#(\d+)'
272+ issue_reference_match = re .fullmatch (issue_rgx , issue_reference )
273+
274+ if issue_reference_match is None :
275+ return None
276+
277+ roomname_rgx = r'(.+?)/(.+)'
278+ roomname_match = re .fullmatch (
279+ roomname_rgx , msg .frm .room .idd , re .IGNORECASE )
280+
281+ if roommatch is None :
282+ return None
283+
284+ return roommatch .group (1 ), roommatch .group (2 ), m .group (1 )
285+
269286 issue_processors = [
270287 process_full_url ,
271- process_short_ref
288+ process_short_ref ,
289+ process_super_short_ref
272290 ]
273291
274292 for issue_processor in issue_processors :
Original file line number Diff line number Diff line change @@ -158,6 +158,12 @@ def test_assign_cmd(self):
158158 testbot .assertCommand ('!assign coala/a#23' ,
159159 "You've been assigned to the issue" )
160160
161+ # test super-short issue reference
162+ mock_issue .assignees = tuple ()
163+ self .mock_team .is_member .return_value = False
164+ testbot .assertCommand ('!assign #23' ,
165+ "You've been assigned to the issue" )
166+
161167 cmd = '!assign https://github.com/{}/{}/issues/{}'
162168 # no assignee, not newcomer
163169 mock_issue .assignees = tuple ()
You can’t perform that action at this time.
0 commit comments