Merge pull request #365 from taigaio/issue/1924/allow-multiple-message-action-on-commits
Allow multiple message actions on commitremotes/origin/enhancement/email-actions
commit
d4135c6928
|
@ -6,6 +6,7 @@
|
|||
- Add a "field type" property for custom fields: 'text' and 'multiline text' right now (thanks to [@artlepool](https://github.com/artlepool))
|
||||
|
||||
### Misc
|
||||
- Allow multiple actions in the commit messages.
|
||||
- Lots of small and not so small bugfixes.
|
||||
|
||||
|
||||
|
|
|
@ -61,8 +61,7 @@ class PushEventHook(BaseEventHook):
|
|||
return
|
||||
|
||||
p = re.compile("tg-(\d+) +#([-\w]+)")
|
||||
m = p.search(message.lower())
|
||||
if m:
|
||||
for m in p.finditer(message.lower()):
|
||||
ref = m.group(1)
|
||||
status_slug = m.group(2)
|
||||
self._change_status(ref, status_slug, bitbucket_user)
|
||||
|
|
|
@ -56,8 +56,7 @@ class PushEventHook(BaseEventHook):
|
|||
return
|
||||
|
||||
p = re.compile("tg-(\d+) +#([-\w]+)")
|
||||
m = p.search(message.lower())
|
||||
if m:
|
||||
for m in p.finditer(message.lower()):
|
||||
ref = m.group(1)
|
||||
status_slug = m.group(2)
|
||||
self._change_status(ref, status_slug, github_user, commit)
|
||||
|
|
|
@ -54,8 +54,7 @@ class PushEventHook(BaseEventHook):
|
|||
return
|
||||
|
||||
p = re.compile("tg-(\d+) +#([-\w]+)")
|
||||
m = p.search(message.lower())
|
||||
if m:
|
||||
for m in p.finditer(message.lower()):
|
||||
ref = m.group(1)
|
||||
status_slug = m.group(2)
|
||||
self._change_status(ref, status_slug, gitlab_user)
|
||||
|
|
|
@ -160,6 +160,26 @@ def test_push_event_user_story_processing(client):
|
|||
assert len(mail.outbox) == 1
|
||||
|
||||
|
||||
def test_push_event_multiple_actions(client):
|
||||
creation_status = f.IssueStatusFactory()
|
||||
role = f.RoleFactory(project=creation_status.project, permissions=["view_issues"])
|
||||
f.MembershipFactory(project=creation_status.project, role=role, user=creation_status.project.owner)
|
||||
new_status = f.IssueStatusFactory(project=creation_status.project)
|
||||
issue1 = f.IssueFactory.create(status=creation_status, project=creation_status.project, owner=creation_status.project.owner)
|
||||
issue2 = f.IssueFactory.create(status=creation_status, project=creation_status.project, owner=creation_status.project.owner)
|
||||
payload = [
|
||||
'{"commits": [{"message": "test message test TG-%s #%s ok test TG-%s #%s ok bye!"}]}' % (issue1.ref, new_status.slug, issue2.ref, new_status.slug)
|
||||
]
|
||||
mail.outbox = []
|
||||
ev_hook1 = event_hooks.PushEventHook(issue1.project, payload)
|
||||
ev_hook1.process_event()
|
||||
issue1 = Issue.objects.get(id=issue1.id)
|
||||
issue2 = Issue.objects.get(id=issue2.id)
|
||||
assert issue1.status.id == new_status.id
|
||||
assert issue2.status.id == new_status.id
|
||||
assert len(mail.outbox) == 2
|
||||
|
||||
|
||||
def test_push_event_processing_case_insensitive(client):
|
||||
creation_status = f.TaskStatusFactory()
|
||||
role = f.RoleFactory(project=creation_status.project, permissions=["view_tasks"])
|
||||
|
|
|
@ -134,6 +134,30 @@ def test_push_event_user_story_processing(client):
|
|||
assert len(mail.outbox) == 1
|
||||
|
||||
|
||||
def test_push_event_multiple_actions(client):
|
||||
creation_status = f.IssueStatusFactory()
|
||||
role = f.RoleFactory(project=creation_status.project, permissions=["view_issues"])
|
||||
f.MembershipFactory(project=creation_status.project, role=role, user=creation_status.project.owner)
|
||||
new_status = f.IssueStatusFactory(project=creation_status.project)
|
||||
issue1 = f.IssueFactory.create(status=creation_status, project=creation_status.project, owner=creation_status.project.owner)
|
||||
issue2 = f.IssueFactory.create(status=creation_status, project=creation_status.project, owner=creation_status.project.owner)
|
||||
payload = {"commits": [
|
||||
{"message": """test message
|
||||
test TG-%s #%s ok
|
||||
test TG-%s #%s ok
|
||||
bye!
|
||||
""" % (issue1.ref, new_status.slug, issue2.ref, new_status.slug)},
|
||||
]}
|
||||
mail.outbox = []
|
||||
ev_hook1 = event_hooks.PushEventHook(issue1.project, payload)
|
||||
ev_hook1.process_event()
|
||||
issue1 = Issue.objects.get(id=issue1.id)
|
||||
issue2 = Issue.objects.get(id=issue2.id)
|
||||
assert issue1.status.id == new_status.id
|
||||
assert issue2.status.id == new_status.id
|
||||
assert len(mail.outbox) == 2
|
||||
|
||||
|
||||
def test_push_event_processing_case_insensitive(client):
|
||||
creation_status = f.TaskStatusFactory()
|
||||
role = f.RoleFactory(project=creation_status.project, permissions=["view_tasks"])
|
||||
|
|
|
@ -179,6 +179,30 @@ def test_push_event_user_story_processing(client):
|
|||
assert len(mail.outbox) == 1
|
||||
|
||||
|
||||
def test_push_event_multiple_actions(client):
|
||||
creation_status = f.IssueStatusFactory()
|
||||
role = f.RoleFactory(project=creation_status.project, permissions=["view_issues"])
|
||||
f.MembershipFactory(project=creation_status.project, role=role, user=creation_status.project.owner)
|
||||
new_status = f.IssueStatusFactory(project=creation_status.project)
|
||||
issue1 = f.IssueFactory.create(status=creation_status, project=creation_status.project, owner=creation_status.project.owner)
|
||||
issue2 = f.IssueFactory.create(status=creation_status, project=creation_status.project, owner=creation_status.project.owner)
|
||||
payload = {"commits": [
|
||||
{"message": """test message
|
||||
test TG-%s #%s ok
|
||||
test TG-%s #%s ok
|
||||
bye!
|
||||
""" % (issue1.ref, new_status.slug, issue2.ref, new_status.slug)},
|
||||
]}
|
||||
mail.outbox = []
|
||||
ev_hook1 = event_hooks.PushEventHook(issue1.project, payload)
|
||||
ev_hook1.process_event()
|
||||
issue1 = Issue.objects.get(id=issue1.id)
|
||||
issue2 = Issue.objects.get(id=issue2.id)
|
||||
assert issue1.status.id == new_status.id
|
||||
assert issue2.status.id == new_status.id
|
||||
assert len(mail.outbox) == 2
|
||||
|
||||
|
||||
def test_push_event_processing_case_insensitive(client):
|
||||
creation_status = f.TaskStatusFactory()
|
||||
role = f.RoleFactory(project=creation_status.project, permissions=["view_tasks"])
|
||||
|
|
Loading…
Reference in New Issue