read.py 437 B

123456789101112
  1. from rest_framework.response import Response
  2. from misago.readtracker.threadstracker import make_posts_read_aware, read_thread
  3. def post_read_endpoint(request, thread, post):
  4. make_posts_read_aware(request.user, thread, [post])
  5. if not post.is_read:
  6. read_thread(request.user, thread, post)
  7. if thread.subscription:
  8. thread.subscription.last_read_on = post.posted_on
  9. return Response({'detail': 'ok'})