Browse Source

Update forum last_post info when a topic is deleted.

sh4nks 10 years ago
parent
commit
4578ab23fc
1 changed files with 4 additions and 0 deletions
  1. 4 0
      flaskbb/forum/models.py

+ 4 - 0
flaskbb/forum/models.py

@@ -548,6 +548,10 @@ class Topic(db.Model):
             try:
             try:
                 # Now the second last post will be the last post
                 # Now the second last post will be the last post
                 self.forum.last_post_id = topic[1].last_post_id
                 self.forum.last_post_id = topic[1].last_post_id
+                self.forum.last_post_title = topic[1].title
+                self.forum.last_post_user_id = topic[1].user_id
+                self.forum.last_post_username = topic[1].username
+                self.forum.last_post_created = topic[1].last_updated
             # Catch an IndexError when you delete the last topic in the forum
             # Catch an IndexError when you delete the last topic in the forum
             # There is no second last post
             # There is no second last post
             except IndexError:
             except IndexError: