##// END OF EJS Templates
If we are replying a multi-thread post, update all its threads and their...
neko259 -
r1046:03d2c227 default
parent child Browse files
Show More
@@ -441,7 +441,10 b' class Post(models.Model, Viewable):'
441
441
442 referenced_threads = referenced_post.get_threads().all()
442 referenced_threads = referenced_post.get_threads().all()
443 for thread in referenced_threads:
443 for thread in referenced_threads:
444 if thread.can_bump():
445 thread.update_bump_status()
446
444 thread.last_edit_time = self.pub_time
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 self.threads.add(thread)
450 self.threads.add(thread)
@@ -73,12 +73,15 b' class Thread(models.Model):'
73 if self.can_bump():
73 if self.can_bump():
74 self.bump_time = self.last_edit_time
74 self.bump_time = self.last_edit_time
75
75
76 if self.get_reply_count() >= settings.MAX_POSTS_PER_THREAD:
76 self.update_bump_status()
77 self.bumpable = False
78 self.update_posts_time()
79
77
80 logger.info('Bumped thread %d' % self.id)
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 def get_reply_count(self):
85 def get_reply_count(self):
83 return self.get_replies().count()
86 return self.get_replies().count()
84
87
@@ -189,3 +192,5 b' class Thread(models.Model):'
189
192
190 def update_posts_time(self):
193 def update_posts_time(self):
191 self.post_set.update(last_edit_time=self.last_edit_time)
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