discourse/discourse — pull request #3000 by riking (2014-11-24 17:08:16+00:00)
Title: Warnings cleanup, with 3 bugfixes

Bugs fixed:

- Don't require login to view post raw.
- Don't try to submit read-guidelines credit for anonymous users.
- Properly render an empty array if too few topics to suggest similar ones, instead of passing `nil` to an array serializer. (extremely fragile code)

----

Detail:

Two files: Remove redundant parentheses from method calls.
Two files: Remove escaping of `_` in regexes.
Three times: Replace unused but necessary variables with `_`.
Three files: Remove initial values for variables that get values in every branch.
Five times: Replace simple `if !condition` with `unless condition`. (Careful judgement was used on whether it enhanced readability.)
about_controller: Line 2 removes a before_filter on the `show` method, so I explicitly define the `show` action to be empty.
users_controller: Potential uninitialized variable. Hashes give nil on not-found, so I made the optional nature explicit with a `|| nil`. Definitely cleaner.
list_controller: Uninitialized variable. Nil is what we want, so explicitly set it.
posts_controller: **Don't require login to view post raw.**
session_controller: Use symbols in `skip_before_filter` for codebase consistency.
topics_controller: Restructure the rescue to eliminate an uninitialized variable usage.
topics_controller: **Properly return an empty array** instead of relying on default behavior for an array serializer passed nil.
users_avatar_controller: Add initial nil values for `upload`.
users_controller: Change an if-statement to unless. (line 229)
users_controller: Include an else in the case statement.
users_controller: **Give a not-logged-in error** for anons submitting FAQ read credit (we don't save it, anyways.)

---

This is mostly style cleanup, but it has some legitimate bugfixes in it.