Add two-way messaging view

> Once an inbound message has been received, there should be a way to
> see the other messages in the system from the same service to the same
> number. Both in and outbound. Nice inbox/whatsapp stylee view or some
> such. This way the context of the reply is understood.
>
> Initially will only see the outbound template, not the actual message,
> but we’re going to change this for the rest (soon), so that you can
> always see the full message for all outbound.
This commit is contained in:
Chris Hill-Scott
2017-05-24 13:19:31 +01:00
parent 183c324f9a
commit f6d8e55579
11 changed files with 292 additions and 12 deletions

View File

@@ -255,13 +255,20 @@ def format_datetime_relative(date):
def get_human_day(time):
# Add 1 hour to get midnight today instead of midnight tomorrow
time = (gmt_timezones(time) - timedelta(hours=1)).strftime('%A')
if time == datetime.utcnow().strftime('%A'):
return 'today'
if time == (datetime.utcnow() + timedelta(days=1)).strftime('%A'):
time_as_day = (gmt_timezones(time) - timedelta(hours=1)).strftime('%A')
six_days_ago = gmt_timezones((datetime.utcnow() + timedelta(days=-6)).isoformat())
if gmt_timezones(time) < six_days_ago:
return format_date_short(time)
if time_as_day == (datetime.utcnow() + timedelta(days=1)).strftime('%A'):
return 'tomorrow'
return time
if time_as_day == datetime.utcnow().strftime('%A'):
return 'today'
if time_as_day == (datetime.utcnow() + timedelta(days=-1)).strftime('%A'):
return 'yesterday'
return format_date_short(time)
def format_time(date):