From b278591f25319eb6cf13d94f84eb71db48c286ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 17 May 2021 17:46:56 +0200 Subject: [PATCH] workflows: fix display of action assigned to "logged users" role (#54032) --- tests/test_workflows.py | 24 ++++++++++++++++++++++++ wcs/workflows.py | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/test_workflows.py b/tests/test_workflows.py index ecc3401c5..a9053ea46 100644 --- a/tests/test_workflows.py +++ b/tests/test_workflows.py @@ -3123,6 +3123,30 @@ def test_workflow_email_line_details(pub): assert sendmail.get_line_details() == 'to computed value' +def test_choice_line_details(pub): + workflow = Workflow(name='choice') + st1 = workflow.add_status('Status1', 'st1') + choice = ChoiceWorkflowStatusItem() + choice.parent = st1 + + assert choice.get_line_details() == 'not completed' + + choice.status = 'wf-%s' % st1.id + choice.label = 'foobar' + assert choice.get_line_details() == '"foobar", to Status1' + + role = pub.role_class(name='foorole') + role.store() + choice.by = [role.id] + assert choice.get_line_details() == '"foobar", to Status1, by foorole' + + choice.by = ['_receiver'] + assert choice.get_line_details() == '"foobar", to Status1, by Recipient' + + choice.by = ['logged-users'] + assert choice.get_line_details() == '"foobar", to Status1, by Logged Users' + + def test_workflow_roles(pub, emails): pub.substitutions.feed(MockSubstitutionVariables()) diff --git a/wcs/workflows.py b/wcs/workflows.py index b89a0e73f..e6613f05d 100644 --- a/wcs/workflows.py +++ b/wcs/workflows.py @@ -2460,7 +2460,7 @@ def render_list_of_roles(workflow, roles): role_label = get_role_translation_label(workflow, r) if role_label: t.append(role_label) - return ', '.join(t) + return ', '.join([str(x) for x in t]) item_classes = []