Browse Source

Thread length limit implemented.

Ralfp 12 years ago
parent
commit
47a86e03ae
2 changed files with 6 additions and 1 deletions
  1. 5 0
      misago/threads/views/posting.py
  2. 1 1
      templates/sora/threads/thread.html

+ 5 - 0
misago/threads/views/posting.py

@@ -123,6 +123,11 @@ class PostingView(BaseView):
                     else:
                         thread.replies += 1
                         thread.score += 5
+                        if (self.request.settings.thread_length > 0
+                            and not thread.closed
+                            and thread.replies >= self.request.settings.thread_length):
+                            thread.closed = True
+                            post.set_checkpoint(self.request, 'limit')
                 thread.save(force_update=True)
                 
                 # Update forum and monitor

+ 1 - 1
templates/sora/threads/thread.html

@@ -111,7 +111,7 @@
       <hr>
       <span>
         {%- if checkpoint.action == 'limit' -%}
-        <i class="icon-lock"></i> {% trans  %}This thread has reached post limit and has been closed.{% endtrans %}
+        <i class="icon-lock"></i> {% trans  %}This thread has reached its post limit and has been closed.{% endtrans %}
         {%- elif checkpoint.action == 'accepted' -%}
         <i class="icon-ok"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} accepted this thread {{ date }}{% endtrans %}
         {%- elif checkpoint.action == 'closed' -%}