mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-15 07:18:58 -04:00
Merge pull request #3993 from alphagov/4-hours-expiry-test-channels
Expire test and operator alerts after 4 hours
This commit is contained in:
@@ -449,14 +449,14 @@ def approve_broadcast_message(service_id, broadcast_message_id):
|
||||
))
|
||||
|
||||
if current_service.trial_mode:
|
||||
broadcast_message.approve_broadcast()
|
||||
broadcast_message.approve_broadcast(channel=current_service.broadcast_channel)
|
||||
return redirect(url_for(
|
||||
'.broadcast_tour',
|
||||
service_id=current_service.id,
|
||||
step_index=6,
|
||||
))
|
||||
elif form.validate_on_submit():
|
||||
broadcast_message.approve_broadcast()
|
||||
broadcast_message.approve_broadcast(channel=current_service.broadcast_channel)
|
||||
else:
|
||||
return render_template(
|
||||
'views/broadcast/view-message.html',
|
||||
|
||||
@@ -248,12 +248,15 @@ class BroadcastMessage(JSONModel):
|
||||
def request_approval(self):
|
||||
self._set_status_to('pending-approval')
|
||||
|
||||
def approve_broadcast(self):
|
||||
def approve_broadcast(self, channel):
|
||||
if channel in {'test', 'operator'}:
|
||||
ttl = timedelta(hours=4, minutes=0)
|
||||
else:
|
||||
ttl = timedelta(hours=22, minutes=30)
|
||||
|
||||
self._update(
|
||||
starts_at=datetime.utcnow().isoformat(),
|
||||
finishes_at=(
|
||||
datetime.utcnow() + timedelta(hours=23, minutes=59)
|
||||
).isoformat(),
|
||||
finishes_at=(datetime.utcnow() + ttl).isoformat(),
|
||||
)
|
||||
self._set_status_to('broadcasting')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user