diaspora/diaspora — Issue #2508: Trying to view a post you're mentioned in by an ignored user causes a NoMethodError
Author: SoftlySplinter
Created: 2011-12-10 13:26:48+00:00
State: open

I was setting up a development environment locally and was just playing around seeing what Diaspora could do and I found this problem.

User A ignores user B.
User B mentions A in a post.
A gets a notification about this, but when trying to view the post the following error is thrown:

### NoMethodError in PostsController#show

undefined method 'public' for nil:NilClass
````
app/controllers/posts_controller.rb:74:in `user_can_not_comment_on_post?'
app/controllers/posts_controller.rb:22:in `show'
lib/chrome_frame.rb:39:in `call'
Request
````

As I'm interested in contributing to Diaspora I would go away and try to fix this, but the main problem would be which route to take. Personally I think it would be wrong for 'A' to not get notified if they're tagged by 'B', even with ignore on (and therefore should also be able to see the post and untag themselves or similar). Another option would be to stop 'B' from even tagging 'A'.