kmpekala / django-forum

Automatically exported from code.google.com/p/django-forum
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

500s generated if user account is deleted but containing thread is not #55

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If a thread is started by someone who turns out to be a spammer, and you
delete that spammer's account, it leaves an empty thread in the system. The
forum templates include {% url profile_detail
latest_post.author %} , which now generates 500 errors for the containing
forum.

The temp fix is to delete the empty thread via the admin, but the view
logic should accommodate this to prevent 500s.

Original issue reported on code.google.com by shacker....@gmail.com on 7 Mar 2009 at 1:06

GoogleCodeExporter commented 8 years ago
Would a on_delete signal make sense that checks when a post is deleted if it is 
the
only post in the thread to also delete the thread?  Or is a script that runs
periodically and checks for threads without posts better?

Original comment by mand...@gmail.com on 7 Mar 2009 at 2:25

GoogleCodeExporter commented 8 years ago

django-forum folks -- sorry about the noise.

{% url profile_detail latest_post.author %} was my addition and is not in the
templates for this project.  Nonetheless I think there is a still a problem with
empty threads ... any advice is appreciated.

shacker,

I got a hack for this for now, just added an {% if %} statement.

http://dpaste.com/8742/

Original comment by mand...@gmail.com on 7 Mar 2009 at 1:20

GoogleCodeExporter commented 8 years ago
I think it would be good to add either an on_delete signal, or code in the Post
.delete() method, to determine if the post is the only one for a thread and then
delete that thread if it is.

I'm unsure of the best way to handle deleted users though; we probably should 
have
*some* sort of logic to stop things becoming totally broken.

If somebody beats me to a patch for the 'delete' handling though it'd be 
appreciated
- the user issue causes fewer problems than having empty threads IMO.

Original comment by rwpoul...@gmail.com on 8 Mar 2009 at 6:28

GoogleCodeExporter commented 8 years ago

Original comment by rwpoul...@gmail.com on 3 May 2009 at 12:33