diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2013-05-24 14:44:11 +0200 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2013-05-24 14:44:11 +0200 |
commit | 2fa3326df18bbfd8b15a6f12b3b66629e93af59c (patch) | |
tree | dbc9552bc426e8dc2017eb29c954fea0d19336f0 /hyperkitty/views | |
parent | 127944f9c2b3d1c07324d6a5dd3bec965f1d7f0a (diff) | |
download | hyperkitty-2fa3326df18bbfd8b15a6f12b3b66629e93af59c.tar.gz hyperkitty-2fa3326df18bbfd8b15a6f12b3b66629e93af59c.tar.xz hyperkitty-2fa3326df18bbfd8b15a6f12b3b66629e93af59c.zip |
Add a unit test for unread posts
Diffstat (limited to 'hyperkitty/views')
-rw-r--r-- | hyperkitty/views/thread.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/hyperkitty/views/thread.py b/hyperkitty/views/thread.py index 22710d7..34fc5d9 100644 --- a/hyperkitty/views/thread.py +++ b/hyperkitty/views/thread.py @@ -55,9 +55,7 @@ def _get_thread_replies(request, thread, offset=1, limit=None): # XXX: Storm-specific emails = emails.find() - emails.config(offset=offset) - if limit is not None: - emails.config(limit=limit) + emails.config(offset=offset, limit=limit) emails = list(emails) for email in emails: @@ -151,7 +149,8 @@ def thread_index(request, mlist_fqdn, threadid, month=None, year=None): if is_bot: # Don't rely on AJAX to load the replies - context["replies"] = _get_thread_replies(request, thread) + # The limit is a safety measure, don't let a bot kill the DB + context["replies"] = _get_thread_replies(request, thread, limit=1000) return render(request, "thread.html", context) |