Deleting the user that created a category results in undeletable category & wrong topic counts


(Scott Schaffter) #1

I was testing out some user flows and seem to have found a small bug.

I created a variety of categories as X user. I then deleted X user. All the category definitions are now deleted because those are considered posts/topics. However, the categories are still there. But cannot be deleted (because they contain posts?).

This might be by design but it also means that these categories now do not have a definition and its unclear how / if you can even add a new category definition through the UI.

I will just delete the categories through rails console, but thought I should mention it. Im not sure how realistic of a use case this will be… but was just trying to do weird things and break stuff before other people on the site do.

The categories also show -1 topics.

Screencast of bug: 2013-11-01_11-06-23.mp4


(Scott Schaffter) #2

Also fun facts - it looks like it also messes up topic counts if one of your topics was in reply or related to a deleted category or broader topic.


(Neil Lalonde) #3

Good catch, I’ll look at it.


(Neil Lalonde) #4

I fixed what you reported in your first post. Categories made by a deleted user can now be deleted. I’ll have to look at the topic count problem later.


(Scott Schaffter) #5

@Neil - THANKS!

Another thought: it might be worth creating a post type “description” or have some toggle to associate a given post with the category description so that IF you delete a user that created a category and you still want to keep that category you can at least keep the description or re-add one…

It might just be better to disable deletion of category description posts to avoid that problem altogether and that the only way to delete the description topic would be to delete the category (as it would make sense they are tied together).


(Neil Lalonde) #6

With my fix on Friday, the category description isn’t deleted.

How did you get to this state? I’m not sure I follow what you mean.


(Scott Schaffter) #7

Perfect.

I can try and replicate but will be hard now given its fixed - but what happened was:

  1. Create category
  2. Create definition
  3. Reply in definition thread
  4. Delete category
  5. My reply in definition thread still counts @ topic / post count but the actual thread is gone. Thus resulting in inaccurate count. (So I believe)

But again - should no longer be an issue with the above fix. So feel free to close out the bug.


(Neil Lalonde) #8

Oh, I see. Yeah it won’t be an issue because the definition topic isn’t deleted.


(Jeff Atwood) #9