diff --git a/plugins/organization_ratings/lib/create_organization_rating_comment.rb b/plugins/organization_ratings/lib/create_organization_rating_comment.rb index f376961..36decbe 100644 --- a/plugins/organization_ratings/lib/create_organization_rating_comment.rb +++ b/plugins/organization_ratings/lib/create_organization_rating_comment.rb @@ -49,16 +49,6 @@ class CreateOrganizationRatingComment < Task rating.save end - def get_comment_message - if self.status == Status::CANCELLED - _("Comment rejected") - elsif self.status == Status::FINISHED - self.body - else - _("No comment") - end - end - def accept_details true end diff --git a/plugins/organization_ratings/lib/organization_rating.rb b/plugins/organization_ratings/lib/organization_rating.rb index c2ee2b6..53cf25d 100644 --- a/plugins/organization_ratings/lib/organization_rating.rb +++ b/plugins/organization_ratings/lib/organization_rating.rb @@ -19,12 +19,18 @@ class OrganizationRating < ActiveRecord::Base def display_comment_to? person if person.present? - person.is_admin? || !comment_rejected? + person.is_admin? || !comment_rejected? || person == self.person else !comment_rejected? end end + def display_rejected_message_to? person + if person.present? + comment_rejected? && (person.is_admin? || person == self.person) + end + end + def self.average_rating organization_id average = OrganizationRating.where(organization_id: organization_id).average(:value) diff --git a/plugins/organization_ratings/views/shared/_user_rating_container.html.erb b/plugins/organization_ratings/views/shared/_user_rating_container.html.erb index 87cc3db..dd3be25 100644 --- a/plugins/organization_ratings/views/shared/_user_rating_container.html.erb +++ b/plugins/organization_ratings/views/shared/_user_rating_container.html.erb @@ -25,8 +25,7 @@
<%= _("No comment") if user_rate.comment.nil? %>
-
<%= _("Comment rejected") if user_rate.comment_rejected? %>
+<%= _("Comment rejected") if user_rate.display_rejected_message_to?(user) %>
<%= user_rate.comment.body if user_rate.display_comment_to?(user) %>