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

Don't show commented tags in the tag stream for now, until we optimize that

parent e98cc4b9
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -56,18 +56,11 @@ class TagsController < ApplicationController ...@@ -56,18 +56,11 @@ class TagsController < ApplicationController
@posts = StatusMessage.where(:public => true, :pending => false) @posts = StatusMessage.where(:public => true, :pending => false)
end end
@tag = ActsAsTaggableOn::Tag.where(:name => params[:name]).first @posts = @posts.tagged_with(params[:name])
if @tag
@posts = @posts.joins("LEFT OUTER JOIN comments ON comments.post_id = posts.id").
joins("INNER JOIN taggings ON (taggings.tag_id = #{@tag.id} AND
((taggable_id = posts.id AND taggable_type = 'Post') OR (taggings.taggable_type = 'Comment' AND taggings.taggable_id = comments.id)))")
max_time = params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now max_time = params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now
@posts = @posts.where(StatusMessage.arel_table[:created_at].lt(max_time)) @posts = @posts.where(StatusMessage.arel_table[:created_at].lt(max_time))
@posts = @posts.includes({:comments => {:author => :profile}}, :photos).order('taggings.created_at DESC').limit(15) @posts = @posts.includes(:comments, :photos).order('posts.created_at DESC').limit(15)
else
@posts = []
end
@posts = PostsFake.new(@posts) @posts = PostsFake.new(@posts)
@commenting_disabled = true @commenting_disabled = true
......
...@@ -71,6 +71,7 @@ describe TagsController do ...@@ -71,6 +71,7 @@ describe TagsController do
end end
it 'displays a post with a comment containing the tag search' do it 'displays a post with a comment containing the tag search' do
pending "toooo slow"
bob.post(:status_message, :text => "other post y'all", :to => 'all') bob.post(:status_message, :text => "other post y'all", :to => 'all')
other_post = bob.post(:status_message, :text => "sup y'all", :to => 'all') other_post = bob.post(:status_message, :text => "sup y'all", :to => 'all')
Factory(:comment, :text => "#hello", :post => other_post) Factory(:comment, :text => "#hello", :post => other_post)
......
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