mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Disable email rules if event is not live (#3181)
This commit is contained in:
@@ -161,12 +161,14 @@ def sendmail_run_rules(sender, **kwargs):
|
||||
mails.filter(
|
||||
state=ScheduledMail.STATE_SCHEDULED,
|
||||
computed_datetime__lte=timezone.now() - datetime.timedelta(days=2),
|
||||
event__live=True,
|
||||
).update(
|
||||
state=ScheduledMail.STATE_MISSED
|
||||
)
|
||||
for m_id in mails.filter(
|
||||
state__in=(ScheduledMail.STATE_SCHEDULED, ScheduledMail.STATE_FAILED),
|
||||
rule__enabled=True,
|
||||
event__live=True,
|
||||
computed_datetime__gte=timezone.now() - datetime.timedelta(days=2),
|
||||
computed_datetime__lte=timezone.now(),
|
||||
).values_list('pk', flat=True):
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
{% block title %}{% trans "Create Email Rule" %}{% endblock %}
|
||||
{% block content %}
|
||||
<h1>{% trans "Create Email Rule" %}</h1>
|
||||
{% if not request.event.live %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "Automated emails are not sent as long as your ticket shop is offline." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block inner %}
|
||||
<form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
This page shows when your rule is planned to be sent.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% if not request.event.live %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "Automated emails are not sent as long as your ticket shop is offline." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<dl class="dl-horizontal">
|
||||
<dt>{% trans "Email subject" %}</dt>
|
||||
<dd>{{ rule.subject }}</dd>
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
your event.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% if not request.event.live %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "Automated emails are not sent as long as your ticket shop is offline." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if rules %}
|
||||
<p>
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
{% block title %}{% trans "Update Email Rule" %}{% endblock %}
|
||||
{% block content %}
|
||||
<h1>{% trans "Update Email Rule" %}</h1>
|
||||
{% if not request.event.live %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "Automated emails are not sent as long as your ticket shop is offline." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block inner %}
|
||||
<form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
|
||||
Reference in New Issue
Block a user