diff --git a/boards/models.py b/boards/models.py --- a/boards/models.py +++ b/boards/models.py @@ -38,9 +38,7 @@ class PostManager(models.Manager): post.tags.add(tag) if parent_id != NO_PARENT: - parent = self.get(id=parent_id) - parent.last_edit_time=timezone.now() - parent.save() + self._bump_thread(parent_id) else: self._delete_old_threads() @@ -104,6 +102,14 @@ class PostManager(models.Manager): for thread in old_threads: self.delete_post(thread) + def _bump_thread(self, thread_id): + thread = self.get(id=thread_id) + + replies_count = len(self.get_thread(thread_id)) + if replies_count <= settings.MAX_POSTS_PER_THREAD: + thread.last_edit_time = timezone.now() + thread.save() + class TagManager(models.Manager): def get_not_empty_tags(self): diff --git a/neboard/settings.py b/neboard/settings.py --- a/neboard/settings.py +++ b/neboard/settings.py @@ -167,8 +167,8 @@ LOGGING = { } # Custom imageboard settings -MAX_POSTS_PER_THREAD = 100 -MAX_THREAD_COUNT = 20 +MAX_POSTS_PER_THREAD = 500 # Thread bumplimit +MAX_THREAD_COUNT = 20 # Old threads will be deleted to preserve this count SITE_NAME = 'Neboard' THEMES = [ diff --git a/templates/thread.html b/templates/thread.html --- a/templates/thread.html +++ b/templates/thread.html @@ -46,7 +46,7 @@