workflows: fix display of email action recipients with computed value (#54032)
gitea-wip/wcs/pipeline/head Build started...
Details
gitea-wip/wcs/pipeline/head Build started...
Details
This commit is contained in:
parent
dc98be2106
commit
8e5b008282
|
@ -3103,6 +3103,26 @@ def test_workflow_display_message_line_details(pub):
|
|||
assert display_message.get_line_details() == 'with actions, for foorole'
|
||||
|
||||
|
||||
def test_workflow_email_line_details(pub):
|
||||
workflow = Workflow(name='email')
|
||||
st1 = workflow.add_status('Status1', 'st1')
|
||||
sendmail = SendmailWorkflowStatusItem()
|
||||
sendmail.parent = st1
|
||||
|
||||
assert sendmail.get_line_details() == 'not completed'
|
||||
|
||||
role = pub.role_class(name='foorole')
|
||||
role.store()
|
||||
sendmail.to = [role.id]
|
||||
assert sendmail.get_line_details() == 'to foorole'
|
||||
|
||||
sendmail.to = ['test@example.net']
|
||||
assert sendmail.get_line_details() == 'to test@example.net'
|
||||
|
||||
sendmail.to = ['{{ foobar }}']
|
||||
assert sendmail.get_line_details() == 'to computed value'
|
||||
|
||||
|
||||
def test_workflow_roles(pub, emails):
|
||||
pub.substitutions.feed(MockSubstitutionVariables())
|
||||
|
||||
|
|
|
@ -2816,7 +2816,7 @@ class SendmailWorkflowStatusItem(WorkflowStatusItem):
|
|||
role_label = get_role_translation_label(self.parent.parent, r)
|
||||
if role_label:
|
||||
t.append(role_label)
|
||||
return ', '.join(t)
|
||||
return ', '.join([str(x) for x in t])
|
||||
|
||||
def get_to_parameter_view_value(self):
|
||||
return self.render_list_of_roles_or_emails(self.to)
|
||||
|
|
Loading…
Reference in New Issue