diaspora/diaspora — pull request #3728 by EJW1 (2012-11-12 03:07:47+00:00)
Title: 3717 wrong status code

Hello!

Thanks so much for this opportunity!

So I made several changes in order to be able to render a 403 http status response when a user isn't authorized to view a post rather than rendering a 404 response. I'm a newbie but this was quite a challenge so I got some help from my teacher (I'm currently taking a RoR class). Because the logic for when a post doesnt exist and when a user isnt authorized to view a post were tightly coupled, I had to do some refactoring of the find_by_guid_or_id_with_user method. I had to change the flow of the "find_by_guid_or_id_with_user method to better allow for the two different scenarios. The refactoring of this method makes its logic more clear, allows for more specific scenarios, and makes it easier to manipulate.

Let me know if there are any improvements I can make or if you have any more questions.