Skip to content
Extraits de code Groupes Projets
Valider 7f5f6966 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

Don't let googlebot 500 us on the public post page

parent 23ea0ed4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -75,8 +75,8 @@ class PublicsController < ApplicationController
@post = Post.where(:guid => params[:guid], :public => true).includes(:author, :comments => :author).first
end
#hax to upgrade logged in users who can comment
if @post
#hax to upgrade logged in users who can comment
if user_signed_in? && current_user.find_visible_post_by_id(@post.id)
redirect_to post_path(@post)
else
......@@ -86,8 +86,8 @@ class PublicsController < ApplicationController
I18n.locale = @person.owner.language
respond_to do |format|
format.all{ render "#{@post.class.to_s.underscore}", :layout => 'application'}
format.xml{ render :xml => @post.to_diaspora_xml }
format.any{ render "#{@post.class.to_s.underscore}", :layout => 'application'}
end
else
flash[:error] = I18n.t('posts.show.not_found')
......
......@@ -66,7 +66,14 @@ describe PublicsController do
status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all')
get :post, :guid => status.id
response.status= 200
response.status.should == 200
end
it 'shows a public photo' do
status = Factory(:status_message_with_photo, :public => true, :author => alice.person)
photo = status.photos.first
get :post, :guid => photo.id
response.status.should == 200
end
it 'does not show a private post' do
......
......@@ -78,7 +78,7 @@ end
Factory.define(:status_message_with_photo, :parent => :status_message) do |m|
m.sequence(:text) { |n| "There are #{n} ninjas in this photo." }
m.after_build do |m|
p = Factory(:photo, :author => m.author, :status_message => m, :pending => false)
p = Factory(:photo, :author => m.author, :status_message => m, :pending => false, :public => m.public)
end
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter