2018-08-12 22:09:34 +02:00
|
|
|
import time
|
2020-06-11 00:54:34 +02:00
|
|
|
from datetime import timedelta
|
|
|
|
|
|
|
|
from django.conf import settings
|
2018-08-12 22:09:34 +02:00
|
|
|
from django.http import HttpRequest, HttpResponse
|
|
|
|
from django.shortcuts import render
|
|
|
|
from django.utils.timezone import now as timezone_now
|
2019-01-06 19:27:53 +01:00
|
|
|
|
2018-08-12 22:09:34 +02:00
|
|
|
from zerver.decorator import zulip_login_required
|
2020-11-03 20:48:57 +01:00
|
|
|
from zerver.lib.digest import DIGEST_CUTOFF, get_digest_context
|
2020-06-11 00:54:34 +02:00
|
|
|
|
2018-08-12 22:09:34 +02:00
|
|
|
|
|
|
|
@zulip_login_required
|
|
|
|
def digest_page(request: HttpRequest) -> HttpResponse:
|
2020-11-03 20:48:57 +01:00
|
|
|
user_profile = request.user
|
2018-08-12 22:09:34 +02:00
|
|
|
cutoff = time.mktime((timezone_now() - timedelta(days=DIGEST_CUTOFF)).timetuple())
|
2020-11-03 20:48:57 +01:00
|
|
|
|
|
|
|
context = get_digest_context(user_profile, cutoff)
|
|
|
|
context.update(physical_address=settings.PHYSICAL_ADDRESS)
|
2019-01-06 19:27:53 +01:00
|
|
|
return render(request, 'zerver/digest_base.html', context=context)
|