Don't show commented tags in the tag stream for now, until we optimize that
This commit is contained in:
parent
e98cc4b960
commit
968100860a
2 changed files with 5 additions and 11 deletions
|
|
@ -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
|
||||||
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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue