don't show new comment form on a non-contact's post
This commit is contained in:
parent
faf27fe05a
commit
cdd225c076
5 changed files with 15 additions and 9 deletions
|
|
@ -43,7 +43,7 @@ class PeopleController < ApplicationController
|
|||
def show
|
||||
@person = Person.find(params[:id].to_id)
|
||||
@post_type = :all
|
||||
@aspect = :none
|
||||
|
||||
if @person
|
||||
@profile = @person.profile
|
||||
@contact = current_user.contact_for(@person)
|
||||
|
|
@ -53,6 +53,8 @@ class PeopleController < ApplicationController
|
|||
@aspects_with_person = @contact.aspects
|
||||
end
|
||||
|
||||
@commenting_disabled = !@contact
|
||||
|
||||
@posts = current_user.posts_from(@person).paginate :page => params[:page]
|
||||
@post_hashes = hashes_for_posts @posts
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
|
||||
module StreamHelper
|
||||
GSUB_THIS = "FIUSDHVIUSHDVIUBAIUHAPOIUXJM"
|
||||
def comment_toggle(count)
|
||||
def comment_toggle(count, commenting_disabled=false)
|
||||
if count == 0
|
||||
unless commenting_disabled
|
||||
link_to "#{t('comments.new_comment.comment').downcase}", '#', :class => "show_post_comments"
|
||||
end
|
||||
elsif count <= 3
|
||||
link_to "#{t('stream_helper.hide_comments')} (#{count})", '#', :class => "show_post_comments"
|
||||
else
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
= render :partial => 'comments/comment', :collection => comment_hashes[-3, 3], :as => :hash
|
||||
-else
|
||||
= render :partial => 'comments/comment', :collection => comment_hashes, :as => :hash
|
||||
|
||||
- unless @commenting_disabled
|
||||
%li.comment.show
|
||||
= new_comment_form(post_id)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@
|
|||
-# the COPYRIGHT file.
|
||||
|
||||
%ul{:class => 'stream', :id => 'main_stream'}
|
||||
- for post_hash in @post_hashes
|
||||
= render 'shared/stream_element', post_hash.merge(:aspects => @aspects)
|
||||
- for post_hash in posts
|
||||
= render 'shared/stream_element', post_hash.merge(:aspects => @aspects, :commenting_disabled => defined?(@commenting_disabled))
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
.info
|
||||
%span.time= link_to(how_long_ago(post), status_message_path(post))
|
||||
= comment_toggle(comments.length)
|
||||
= comment_toggle(comments.length, defined?(@commenting_disabled))
|
||||
|
||||
= render "comments/comments", :post_id => post.id, :comment_hashes => comments, :condensed => true
|
||||
= render "comments/comments", :post_id => post.id, :comment_hashes => comments, :condensed => true, :commenting_disabled => defined?(@commenting_disabled)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue