comparison gpp/forums/views/main.py @ 293:c92fb89dbc7d

Fixed a bug where if you tried to delete a topic the new last post might be in that topic, so a cascading delete would occur and the forum would get deleted.
author Brian Neal <bgneal@gmail.com>
date Wed, 29 Dec 2010 04:56:53 +0000
parents 72fd300685d5
children 26fc9ac9a0eb
comparison
equal deleted inserted replaced
292:2367c4795c92 293:c92fb89dbc7d
470 Adjusts the parent forum's last_post as needed. 470 Adjusts the parent forum's last_post as needed.
471 Note that we don't bother adjusting all the users' 471 Note that we don't bother adjusting all the users'
472 post counts as that doesn't seem to be worth the effort. 472 post counts as that doesn't seem to be worth the effort.
473 """ 473 """
474 if topic.forum.last_post and topic.forum.last_post.topic == topic: 474 if topic.forum.last_post and topic.forum.last_post.topic == topic:
475 topic.forum.last_post_pre_delete() 475 topic.forum.last_post_pre_delete(deleting_topic=True)
476 topic.forum.save() 476 topic.forum.save()
477 477
478 # delete subscriptions to this topic 478 # delete subscriptions to this topic
479 topic.subscribers.clear() 479 topic.subscribers.clear()
480 topic.bookmarkers.clear() 480 topic.bookmarkers.clear()