comment on tagged posts wip

This commit is contained in:
Maxwell Salzberg 2011-10-04 17:55:48 -07:00
parent 9cc7523f0e
commit a3eeb9f3c1
3 changed files with 4 additions and 4 deletions

View file

@ -9,7 +9,6 @@ class TagFollowingsController < ApplicationController
before_filter :save_sort_order, :only => :index before_filter :save_sort_order, :only => :index
def index def index
@commenting_disabled = true
@stream = TagStream.new(current_user, :max_time => params[:max_time], :order => sort_order) @stream = TagStream.new(current_user, :max_time => params[:max_time], :order => sort_order)
if params[:only_posts] if params[:only_posts]
render :partial => 'shared/stream', :locals => {:posts => @stream.posts} render :partial => 'shared/stream', :locals => {:posts => @stream.posts}

View file

@ -1,3 +1,3 @@
ContentUpdater.addCommentToPost("<%= @comment.post.guid %>", ContentUpdater.addCommentToPost("<%= @comment.post.guid %>",
"<%= @comment.guid%>", "<%= @comment.guid%>",
"<%= escape_javascript(render(:partial => 'comments/comment', :locals => { :comment => @comment, :person => current_user.person}))%>"); "<%= escape_javascript(render(:partial => 'comments/comment', :locals => { :comment => @comment, :person => current_user.person, :post => @comment.post}))%>");

View file

@ -28,14 +28,15 @@ class TagStream < BaseStream
I18n.translate('streams.tags.contacts_title') I18n.translate('streams.tags.contacts_title')
end end
def can_comment_on?(post) def can_comment?(post)
@can_comment_cache ||= {} @can_comment_cache ||= {}
@can_comment_cache[post.id] ||= contacts_in_stream.find{|contact| contact.person_id == post.author.id}.present? @can_comment_cache[post.id] ||= contacts_in_stream.find{|contact| contact.person_id == post.author.id}.present?
@can_comment_cache[post.id] ||= user.person.id == post.author.id
@can_comment_cache[post.id] @can_comment_cache[post.id]
end end
def contacts_in_stream def contacts_in_stream
@contacts_in_stream ||= Contact.where(:user => user, :person => people).all @contacts_in_stream ||= Contact.where(:user_id => user.id, :person_id => people.map{|x| x.id}).all
end end
private private