misc: remove mail-templates site option (#57260)
This commit is contained in:
parent
d44e1e84cf
commit
f5fbc91127
|
@ -56,16 +56,6 @@ def superuser(pub):
|
|||
return user1
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mail_templates_option(pub):
|
||||
if not pub.site_options.has_section('options'):
|
||||
pub.site_options.add_section('options')
|
||||
pub.site_options.set('options', 'mail-templates', 'true')
|
||||
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
|
||||
pub.site_options.write(fd)
|
||||
return pub
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mail_template():
|
||||
MailTemplate.wipe()
|
||||
|
@ -76,18 +66,7 @@ def mail_template():
|
|||
return mail_template
|
||||
|
||||
|
||||
def test_mail_templates_disabled(pub, superuser):
|
||||
if not pub.site_options.has_section('options'):
|
||||
pub.site_options.add_section('options')
|
||||
pub.site_options.set('options', 'mail-templates', 'false')
|
||||
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
|
||||
pub.site_options.write(fd)
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/workflows/')
|
||||
assert 'Mail Templates' not in resp
|
||||
|
||||
|
||||
def test_mail_templates_basics(pub, superuser, mail_templates_option):
|
||||
def test_mail_templates_basics(pub, superuser):
|
||||
MailTemplate.wipe()
|
||||
|
||||
app = login(get_app(pub))
|
||||
|
@ -141,7 +120,7 @@ def test_mail_templates_basics(pub, superuser, mail_templates_option):
|
|||
assert 'first mail template' in resp
|
||||
|
||||
|
||||
def test_mail_template_in_use(pub, superuser, mail_templates_option):
|
||||
def test_mail_template_in_use(pub, superuser):
|
||||
Workflow.wipe()
|
||||
MailTemplate.wipe()
|
||||
workflow = Workflow(name='test workflow')
|
||||
|
@ -175,7 +154,7 @@ def test_mail_template_in_use(pub, superuser, mail_templates_option):
|
|||
assert 'still used' in resp.text
|
||||
|
||||
|
||||
def test_admin_workflow_edit(pub, superuser, mail_templates_option):
|
||||
def test_admin_workflow_edit(pub, superuser):
|
||||
Workflow.wipe()
|
||||
MailTemplate.wipe()
|
||||
mail_template = MailTemplate(name='test mail template')
|
||||
|
@ -204,7 +183,7 @@ def test_admin_workflow_edit(pub, superuser, mail_templates_option):
|
|||
assert workflow.possible_status[0].items[0].mail_template == 'test-mail-template'
|
||||
|
||||
|
||||
def test_workflow_send_mail_template_with_sql(superuser, mail_templates_option, emails):
|
||||
def test_workflow_send_mail_template_with_sql(superuser, emails):
|
||||
pub = create_temporary_pub(sql_mode=True)
|
||||
req = HTTPRequest(None, {'SCRIPT_NAME': '/', 'SERVER_NAME': 'example.net'})
|
||||
pub.set_app_dir(req)
|
||||
|
@ -257,7 +236,7 @@ def test_workflow_send_mail_template_with_sql(superuser, mail_templates_option,
|
|||
assert logged_error.summary == 'reference to invalid mail template test-mail-template in status Status1'
|
||||
|
||||
|
||||
def test_workflow_send_mail_template_attachments(pub, superuser, mail_templates_option, emails):
|
||||
def test_workflow_send_mail_template_attachments(pub, superuser, emails):
|
||||
Workflow.wipe()
|
||||
MailTemplate.wipe()
|
||||
|
||||
|
|
|
@ -1909,8 +1909,7 @@ class WorkflowsDirectory(Directory):
|
|||
r += htmltext('<h2>%s</h2>') % _('Workflows')
|
||||
r += htmltext('<span class="actions">')
|
||||
if is_global_accessible():
|
||||
if get_publisher().has_site_option('mail-templates'):
|
||||
r += htmltext('<a href="mail-templates/">%s</a>') % _('Mail Templates')
|
||||
r += htmltext('<a href="mail-templates/">%s</a>') % _('Mail Templates')
|
||||
r += htmltext('<a href="data-sources/">%s</a>') % _('Data sources')
|
||||
r += htmltext('<a href="categories/">%s</a>') % _('Categories')
|
||||
r += htmltext('<a href="import" rel="popup">%s</a>') % _('Import')
|
||||
|
|
|
@ -382,7 +382,6 @@ class QommonPublisher(Publisher):
|
|||
def has_site_option(self, option):
|
||||
defaults = {
|
||||
'studio': True,
|
||||
'mail-templates': True,
|
||||
'external-workflow': True,
|
||||
'complex-data': True,
|
||||
}
|
||||
|
|
|
@ -2972,7 +2972,7 @@ class SendmailWorkflowStatusItem(WorkflowStatusItem):
|
|||
super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
|
||||
subject_body_attrs = {}
|
||||
if 'subject' in parameters or 'body' in parameters:
|
||||
if get_publisher().has_site_option('mail-templates') and MailTemplate.count():
|
||||
if MailTemplate.count():
|
||||
subject_body_attrs = {
|
||||
'data-dynamic-display-value': '',
|
||||
'data-dynamic-display-child-of': '%smail_template' % prefix,
|
||||
|
@ -3001,11 +3001,7 @@ class SendmailWorkflowStatusItem(WorkflowStatusItem):
|
|||
size=40,
|
||||
attrs=subject_body_attrs,
|
||||
)
|
||||
if (
|
||||
'mail_template' in parameters
|
||||
and get_publisher().has_site_option('mail-templates')
|
||||
and MailTemplate.count()
|
||||
):
|
||||
if 'mail_template' in parameters and MailTemplate.count():
|
||||
form.add(
|
||||
SingleSelectWidget,
|
||||
'%smail_template' % prefix,
|
||||
|
|
Loading…
Reference in New Issue