Show More
@@ -441,7 +441,10 b' class Post(models.Model, Viewable):' | |||
|
441 | 441 | |
|
442 | 442 | referenced_threads = referenced_post.get_threads().all() |
|
443 | 443 | for thread in referenced_threads: |
|
444 | if thread.can_bump(): | |
|
445 | thread.update_bump_status() | |
|
446 | ||
|
444 | 447 | thread.last_edit_time = self.pub_time |
|
445 | thread.save(update_fields=['last_edit_time']) | |
|
448 | thread.save(update_fields=['last_edit_time', 'bumpable']) | |
|
446 | 449 | |
|
447 | 450 | self.threads.add(thread) |
@@ -73,12 +73,15 b' class Thread(models.Model):' | |||
|
73 | 73 | if self.can_bump(): |
|
74 | 74 | self.bump_time = self.last_edit_time |
|
75 | 75 | |
|
76 | if self.get_reply_count() >= settings.MAX_POSTS_PER_THREAD: | |
|
77 | self.bumpable = False | |
|
78 | self.update_posts_time() | |
|
76 | self.update_bump_status() | |
|
79 | 77 | |
|
80 | 78 | logger.info('Bumped thread %d' % self.id) |
|
81 | 79 | |
|
80 | def update_bump_status(self): | |
|
81 | if self.get_reply_count() >= settings.MAX_POSTS_PER_THREAD: | |
|
82 | self.bumpable = False | |
|
83 | self.update_posts_time() | |
|
84 | ||
|
82 | 85 | def get_reply_count(self): |
|
83 | 86 | return self.get_replies().count() |
|
84 | 87 | |
@@ -189,3 +192,5 b' class Thread(models.Model):' | |||
|
189 | 192 | |
|
190 | 193 | def update_posts_time(self): |
|
191 | 194 | self.post_set.update(last_edit_time=self.last_edit_time) |
|
195 | for post in self.post_set.all(): | |
|
196 | post.threads.update(last_edit_time=self.last_edit_time) |
General Comments 0
You need to be logged in to leave comments.
Login now