# HG changeset patch # User neko259 # Date 2015-03-23 14:36:48 # Node ID 03d2c22748d83ccf36ea904775c28e4d8c37b34e # Parent a9c8dc93ef7a70961bd313a735aca1b476cca482 If we are replying a multi-thread post, update all its threads and their bumplimit status even if we are not bumping them diff --git a/boards/models/post.py b/boards/models/post.py --- a/boards/models/post.py +++ b/boards/models/post.py @@ -441,7 +441,10 @@ class Post(models.Model, Viewable): referenced_threads = referenced_post.get_threads().all() for thread in referenced_threads: + if thread.can_bump(): + thread.update_bump_status() + thread.last_edit_time = self.pub_time - thread.save(update_fields=['last_edit_time']) + thread.save(update_fields=['last_edit_time', 'bumpable']) self.threads.add(thread) diff --git a/boards/models/thread.py b/boards/models/thread.py --- a/boards/models/thread.py +++ b/boards/models/thread.py @@ -73,12 +73,15 @@ class Thread(models.Model): if self.can_bump(): self.bump_time = self.last_edit_time - if self.get_reply_count() >= settings.MAX_POSTS_PER_THREAD: - self.bumpable = False - self.update_posts_time() + self.update_bump_status() logger.info('Bumped thread %d' % self.id) + def update_bump_status(self): + if self.get_reply_count() >= settings.MAX_POSTS_PER_THREAD: + self.bumpable = False + self.update_posts_time() + def get_reply_count(self): return self.get_replies().count() @@ -189,3 +192,5 @@ class Thread(models.Model): def update_posts_time(self): self.post_set.update(last_edit_time=self.last_edit_time) + for post in self.post_set.all(): + post.threads.update(last_edit_time=self.last_edit_time)