notifications: add settings for default duration (#22730)

This commit is contained in:
Frédéric Péters 2018-03-22 10:34:36 +01:00
parent 408711c09e
commit a00a5358c4
2 changed files with 7 additions and 2 deletions

View File

@ -104,12 +104,14 @@ class Notification(models.Model):
'''
start_timestamp = start_timestamp or now()
if duration:
if end_timestamp:
pass
elif duration:
if not isinstance(duration, timedelta):
duration = timedelta(seconds=duration)
end_timestamp = start_timestamp + duration
else:
end_timestamp = end_timestamp or start_timestamp + timedelta(days=3)
end_timestamp = start_timestamp + timedelta(days=settings.COMBO_DEFAULT_NOTIFICATION_DURATION)
defaults = {
'summary': summary,

View File

@ -297,6 +297,9 @@ SITE_BASE_URL = 'http://localhost'
# we use 28s by default: timeout just before web server, which is usually 30s
REQUESTS_TIMEOUT = 28
# default duration of notifications (in days)
COMBO_DEFAULT_NOTIFICATION_DURATION = 3
# hide work-in-progress/experimental/whatever cells for now
BOOKING_CALENDAR_CELL_ENABLED = False
NEWSLETTERS_CELL_ENABLED = False