misc: add role details to substitution variables (#10531)
This commit is contained in:
parent
054f757e8b
commit
1123e28132
|
@ -242,6 +242,10 @@ champs, etc.
|
|||
<td><p><code>form_role_receiver_emails</code></p></td>
|
||||
<td><p>Les adresses électroniques associées au rôle en charge du traitement</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><code>form_role_receiver_details</code></p></td>
|
||||
<td><p>La description (« détail du rôle ») associée au rôle en charge du traitement</p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -1474,6 +1474,7 @@ def test_workflow_roles(pub):
|
|||
Role.wipe()
|
||||
role1 = Role(name='foo')
|
||||
role1.emails = ['foo@localhost']
|
||||
role1.details = 'Hello World'
|
||||
role1.store()
|
||||
|
||||
role2 = Role(name='bar')
|
||||
|
@ -1517,6 +1518,7 @@ def test_workflow_roles(pub):
|
|||
substvars = formdata.get_substitution_variables()
|
||||
assert substvars.get('form_role_other_name') == 'bar'
|
||||
assert substvars.get('form_role_slug_with_dash_name') == 'foo'
|
||||
assert substvars.get('form_role_slug_with_dash_details') == 'Hello World'
|
||||
|
||||
def test_criticality(pub):
|
||||
FormDef.wipe()
|
||||
|
|
|
@ -74,6 +74,7 @@ class Role(StorableObject):
|
|||
def get_substitution_variables(self, prefix=''):
|
||||
data = {}
|
||||
data[prefix + 'name'] = self.name
|
||||
data[prefix + 'details'] = self.details or ''
|
||||
if self.emails and not self.emails_to_members:
|
||||
data[prefix + 'emails'] = ', '.join(self.emails)
|
||||
return data
|
||||
|
|
Loading…
Reference in New Issue