DC MS fix crazy status.net linkback accept header
This commit is contained in:
parent
36e32ba497
commit
3bde507a3a
2 changed files with 7 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue