Skip to content
Extraits de code Groupes Projets
Valider cdd225c0 rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

don't show new comment form on a non-contact's post

parent faf27fe0
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -43,7 +43,7 @@ class PeopleController < ApplicationController ...@@ -43,7 +43,7 @@ class PeopleController < ApplicationController
def show def show
@person = Person.find(params[:id].to_id) @person = Person.find(params[:id].to_id)
@post_type = :all @post_type = :all
@aspect = :none
if @person if @person
@profile = @person.profile @profile = @person.profile
@contact = current_user.contact_for(@person) @contact = current_user.contact_for(@person)
...@@ -53,6 +53,8 @@ class PeopleController < ApplicationController ...@@ -53,6 +53,8 @@ class PeopleController < ApplicationController
@aspects_with_person = @contact.aspects @aspects_with_person = @contact.aspects
end end
@commenting_disabled = !@contact
@posts = current_user.posts_from(@person).paginate :page => params[:page] @posts = current_user.posts_from(@person).paginate :page => params[:page]
@post_hashes = hashes_for_posts @posts @post_hashes = hashes_for_posts @posts
......
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
module StreamHelper module StreamHelper
GSUB_THIS = "FIUSDHVIUSHDVIUBAIUHAPOIUXJM" GSUB_THIS = "FIUSDHVIUSHDVIUBAIUHAPOIUXJM"
def comment_toggle(count) def comment_toggle(count, commenting_disabled=false)
if count == 0 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 elsif count <= 3
link_to "#{t('stream_helper.hide_comments')} (#{count})", '#', :class => "show_post_comments" link_to "#{t('stream_helper.hide_comments')} (#{count})", '#', :class => "show_post_comments"
else else
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
= render :partial => 'comments/comment', :collection => comment_hashes[-3, 3], :as => :hash = render :partial => 'comments/comment', :collection => comment_hashes[-3, 3], :as => :hash
-else -else
= render :partial => 'comments/comment', :collection => comment_hashes, :as => :hash = 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)
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
%ul{:class => 'stream', :id => 'main_stream'} %ul{:class => 'stream', :id => 'main_stream'}
- for post_hash in @post_hashes - for post_hash in posts
= render 'shared/stream_element', post_hash.merge(:aspects => @aspects) = render 'shared/stream_element', post_hash.merge(:aspects => @aspects, :commenting_disabled => defined?(@commenting_disabled))
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
.info .info
%span.time= link_to(how_long_ago(post), status_message_path(post)) %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)
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