diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 0bf9408ceea7e2f0cc548c8e4070644a4096ce3e..9769b7d9202882abea167ac6be0c9953ea5c7468 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -4,6 +4,7 @@ class PostsController < ApplicationController before_filter :authenticate_user!, :except => :show + before_filter :set_format_if_malformed_from_status_net, :only => :show respond_to :html, :mobile, @@ -28,7 +29,7 @@ class PostsController < ApplicationController respond_to do |format| format.xml{ render :xml => @post.to_diaspora_xml } - format.any{} + format.any{render 'posts/show.html.haml'} end else @@ -52,4 +53,8 @@ class PostsController < ApplicationController render :nothing => true, :status => 404 end end + + def set_format_if_malformed_from_status_net + request.format = :html if request.format == 'application/html+xml' + end end diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb index f6231596e52e3c2efdc8b0e0beda0351ed5217a2..972f64e9ba12aa40d7a2ab1db5499feac4631492 100644 --- a/spec/controllers/posts_controller_spec.rb +++ b/spec/controllers/posts_controller_spec.rb @@ -54,6 +54,7 @@ describe PostsController do end context 'user not signed in' do + it 'shows a public post' do status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all') @@ -62,7 +63,6 @@ describe PostsController do end it 'succeeds for statusnet' do - pending "StatusNet send a weird ACCEPT header" status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all') @request.env["HTTP_ACCEPT"] = "application/html+xml,text/html" get :show, :id => status.id