From f91492502bf6d7a212489aac1e4fbed7e0ea70bc Mon Sep 17 00:00:00 2001 From: mpetitdant Date: Fri, 14 Mar 2014 00:38:36 +0100 Subject: [PATCH 1/2] fix #187 --- app/models/Session.java | 11 +++++++++++ app/views/Sessions/show.html | 9 +++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/models/Session.java b/app/models/Session.java index 313b594a..575a56a5 100644 --- a/app/models/Session.java +++ b/app/models/Session.java @@ -145,6 +145,17 @@ public void addComment(SessionComment comment) { } } + public List getPublicComments() { + List result = new ArrayList(); + + for (SessionComment comment : comments) { + if ( !comment.privatelyVisible ) { + result.add(comment); + } + } + return result; + } + public static List findValidatedLinkedWith(Interest interest) { return find("valid = true and ? in elements(interests)", interest).fetch(); } diff --git a/app/views/Sessions/show.html b/app/views/Sessions/show.html index 7e868497..6f920cf1 100644 --- a/app/views/Sessions/show.html +++ b/app/views/Sessions/show.html @@ -119,7 +119,12 @@

${talk.title} [&{'enum.TalkFormat.'+talk.format}#{lang-flag

${talk.getNbLooks()} consultation${talk.getNbLooks().pluralize()} #{if talk.comments} - — ${talk.comments.size()} commentaire${talk.comments.size().pluralize()} + #{if showPrivateComments} + — ${talk.comments.size()} commentaire${talk.comments.size().pluralize()} + #{/if} + #{else} + — ${talk.publicComments.size()} commentaire${talk.comments.size().pluralize()} + #{/else} #{/if} #{if talk.valid} — #{socialbar/} @@ -218,7 +223,7 @@

Activité récente

From a17416af0494f5ef35a927178c5702c613f0dbd6 Mon Sep 17 00:00:00 2001 From: mpetitdant Date: Fri, 14 Mar 2014 09:26:28 +0100 Subject: [PATCH 2/2] solve clacote comment on PR --- app/views/Sessions/show.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/Sessions/show.html b/app/views/Sessions/show.html index 6f920cf1..133882b8 100644 --- a/app/views/Sessions/show.html +++ b/app/views/Sessions/show.html @@ -123,7 +123,7 @@

${talk.title} [&{'enum.TalkFormat.'+talk.format}#{lang-flag — ${talk.comments.size()} commentaire${talk.comments.size().pluralize()} #{/if} #{else} - — ${talk.publicComments.size()} commentaire${talk.comments.size().pluralize()} + — ${talk.publicComments.size()} commentaire${talk.publicComments.size().pluralize()} #{/else} #{/if} #{if talk.valid}