workflows: adapt trigger roles label for functions (#76674) #888
|
@ -1498,6 +1498,25 @@ def test_workflows_edit_jump_timeout(pub):
|
||||||
assert resp.text.count('ComputedExpressionWidget') == 1
|
assert resp.text.count('ComputedExpressionWidget') == 1
|
||||||
|
|
||||||
|
|
||||||
|
def test_workflows_edit_jump_trigger_functions_roles_label(pub):
|
||||||
|
create_superuser(pub)
|
||||||
|
Workflow.wipe()
|
||||||
|
workflow = Workflow(name='foo')
|
||||||
|
st1 = workflow.add_status(name='baz')
|
||||||
|
jump = st1.add_action('jump')
|
||||||
|
workflow.store()
|
||||||
|
|
||||||
|
app = login(get_app(pub))
|
||||||
|
resp = app.get(jump.get_admin_url())
|
||||||
|
assert resp.pyquery('#form_label_by').text() == 'Functions or roles allowed to trigger'
|
||||||
|
|
||||||
|
pub.site_options.set('options', 'workflow-functions-only', 'true')
|
||||||
|
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
|
||||||
|
pub.site_options.write(fd)
|
||||||
|
resp = app.get(jump.get_admin_url())
|
||||||
|
assert resp.pyquery('#form_label_by').text() == 'Functions allowed to trigger'
|
||||||
|
|
||||||
|
|
||||||
def test_workflows_jump_target_links(pub):
|
def test_workflows_jump_target_links(pub):
|
||||||
create_superuser(pub)
|
create_superuser(pub)
|
||||||
Workflow.wipe()
|
Workflow.wipe()
|
||||||
|
|
|
@ -230,10 +230,14 @@ class JumpWorkflowStatusItem(WorkflowStatusJumpItem):
|
||||||
size=40,
|
size=40,
|
||||||
)
|
)
|
||||||
if 'by' in parameters:
|
if 'by' in parameters:
|
||||||
|
if get_publisher().has_site_option('workflow-functions-only'):
|
||||||
|
label = _('Functions allowed to trigger')
|
||||||
|
else:
|
||||||
|
label = _('Functions or roles allowed to trigger')
|
||||||
form.add(
|
form.add(
|
||||||
WidgetList,
|
WidgetList,
|
||||||
'%sby' % prefix,
|
'%sby' % prefix,
|
||||||
title=_('Roles allowed to trigger'),
|
title=label,
|
||||||
element_type=SingleSelectWidget,
|
element_type=SingleSelectWidget,
|
||||||
value=self.by,
|
value=self.by,
|
||||||
add_element_label=self.get_add_role_label(),
|
add_element_label=self.get_add_role_label(),
|
||||||
|
|
Loading…
Reference in New Issue