diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 0d84aa1e1..95e4f1ed0 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -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 diff --git a/app/helpers/stream_helper.rb b/app/helpers/stream_helper.rb index 3f67e7650..22667c168 100644 --- a/app/helpers/stream_helper.rb +++ b/app/helpers/stream_helper.rb @@ -4,9 +4,11 @@ module StreamHelper GSUB_THIS = "FIUSDHVIUSHDVIUBAIUHAPOIUXJM" - def comment_toggle(count) + def comment_toggle(count, commenting_disabled=false) if count == 0 - link_to "#{t('comments.new_comment.comment').downcase}", '#', :class => "show_post_comments" + 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 diff --git a/app/views/comments/_comments.html.haml b/app/views/comments/_comments.html.haml index 4a2c8f71c..80855a484 100644 --- a/app/views/comments/_comments.html.haml +++ b/app/views/comments/_comments.html.haml @@ -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 - %li.comment.show - = new_comment_form(post_id) + + - unless @commenting_disabled + %li.comment.show + = new_comment_form(post_id) diff --git a/app/views/shared/_stream.haml b/app/views/shared/_stream.haml index df9a55f92..b43f40f5d 100644 --- a/app/views/shared/_stream.haml +++ b/app/views/shared/_stream.haml @@ -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)) diff --git a/app/views/shared/_stream_element.html.haml b/app/views/shared/_stream_element.html.haml index 0b902b48e..23a301ef1 100644 --- a/app/views/shared/_stream_element.html.haml +++ b/app/views/shared/_stream_element.html.haml @@ -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)