mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Merge pull request #3581 from alphagov/remove-end-time
Remove choice of ‘End time’ from broadcast journey
This commit is contained in:
@@ -1387,24 +1387,6 @@ class ChooseTimeForm(StripWhitespaceForm):
|
||||
)
|
||||
|
||||
|
||||
class ChooseBroadcastDurationForm(StripWhitespaceForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.finishes_at.choices = [
|
||||
get_time_value_and_label(hour) for hour in get_next_hours_until(
|
||||
get_furthest_possible_scheduled_time()
|
||||
)
|
||||
]
|
||||
self.finishes_at.categories = get_next_days_until(
|
||||
get_furthest_possible_scheduled_time()
|
||||
)
|
||||
|
||||
finishes_at = RadioField(
|
||||
'End time',
|
||||
)
|
||||
|
||||
|
||||
class CreateKeyForm(StripWhitespaceForm):
|
||||
def __init__(self, existing_keys, *args, **kwargs):
|
||||
self.existing_key_names = [
|
||||
|
||||
@@ -13,7 +13,6 @@ from app.main import main
|
||||
from app.main.forms import (
|
||||
BroadcastAreaForm,
|
||||
BroadcastAreaFormWithSelectAll,
|
||||
ChooseBroadcastDurationForm,
|
||||
SearchByNameForm,
|
||||
)
|
||||
from app.models.broadcast_message import BroadcastMessage, BroadcastMessages
|
||||
@@ -211,10 +210,8 @@ def preview_broadcast_message(service_id, broadcast_message_id):
|
||||
broadcast_message_id,
|
||||
service_id=current_service.id,
|
||||
)
|
||||
form = ChooseBroadcastDurationForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
broadcast_message.request_approval(until=form.finishes_at.data)
|
||||
if request.method == 'POST':
|
||||
broadcast_message.request_approval()
|
||||
return redirect(url_for(
|
||||
'.view_broadcast_message',
|
||||
service_id=current_service.id,
|
||||
@@ -224,7 +221,6 @@ def preview_broadcast_message(service_id, broadcast_message_id):
|
||||
return render_template(
|
||||
'views/broadcast/preview-message.html',
|
||||
broadcast_message=broadcast_message,
|
||||
form=form,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from notifications_utils.template import BroadcastPreviewTemplate
|
||||
from orderedset import OrderedSet
|
||||
@@ -153,15 +153,15 @@ class BroadcastMessage(JSONModel):
|
||||
data=kwargs,
|
||||
)
|
||||
|
||||
def request_approval(self, until):
|
||||
self._update(
|
||||
finishes_at=until,
|
||||
)
|
||||
def request_approval(self):
|
||||
self._set_status_to('pending-approval')
|
||||
|
||||
def approve_broadcast(self):
|
||||
self._update(
|
||||
starts_at=datetime.utcnow().isoformat(),
|
||||
finishes_at=(
|
||||
datetime.utcnow() + timedelta(hours=23, minutes=59)
|
||||
).isoformat(),
|
||||
)
|
||||
self._set_status_to('broadcasting')
|
||||
|
||||
|
||||
@@ -29,17 +29,6 @@
|
||||
{{ broadcast_message.template|string }}
|
||||
|
||||
{% call form_wrapper() %}
|
||||
<h3 class="govuk-heading-s govuk-!-margin-top-6 govuk-!-margin-bottom-1">
|
||||
Start time
|
||||
</h3>
|
||||
<p class="govuk-body govuk-!-margin-bottom-4">
|
||||
Your broadcast will start when it’s approved by another member of your team.
|
||||
</p>
|
||||
{{ radio_select(
|
||||
form.finishes_at,
|
||||
show_now_as_default=False,
|
||||
bold_legend=True
|
||||
) }}
|
||||
{{ page_footer('Submit for approval') }}
|
||||
{% endcall %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user