discourse/discourse — pull request #879 by mattvanhorn (2013-05-22 08:11:39+00:00)
Title: refactor guardian class for clarity & correctness

introduce NullUser to avoid type-checking
DRY up code
reduce number of multiple returns
remove some redundant/impossible logic branches
add pending test for possible bug
add test & fix for ability to flag archived posts
add #secure_category? method to topic class
Fix bug that prevented flagging of archived topics
Rename NullUser to AnonymousUser
DRY up can_? methods
Fix some ownership logic, and a test, for Guardian