fix 500 when viewing a nonexsitaint status message
This commit is contained in:
parent
d202200a88
commit
2784f641ba
3 changed files with 18 additions and 8 deletions
|
|
@ -73,6 +73,7 @@ class StatusMessagesController < ApplicationController
|
|||
|
||||
def show
|
||||
@status_message = current_user.find_visible_post_by_id params[:id]
|
||||
if @status_message
|
||||
@object_aspect_ids = @status_message.aspects.map{|a| a.id}
|
||||
|
||||
# mark corresponding notification as read
|
||||
|
|
@ -82,6 +83,9 @@ class StatusMessagesController < ApplicationController
|
|||
end
|
||||
|
||||
respond_with @status_message
|
||||
else
|
||||
redirect_to :back
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
= render 'photos/index', :photos => @posts
|
||||
- else
|
||||
#main_stream.stream
|
||||
= render 'shared/stream', :posts => @fakes
|
||||
= render 'shared/stream', :posts => @fakes, :commenting_disabled => @commenting_disabled
|
||||
%a.paginate
|
||||
= t("more")
|
||||
= will_paginate @posts
|
||||
|
|
|
|||
|
|
@ -43,6 +43,12 @@ describe StatusMessagesController do
|
|||
note.reload
|
||||
}.should change(note, :unread).from(true).to(false)
|
||||
end
|
||||
|
||||
|
||||
it 'redirects to back if there is no status message' do
|
||||
get :show, :id => 2345
|
||||
response.status.should == 302
|
||||
end
|
||||
end
|
||||
|
||||
describe '#create' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue