From 341da14b031c3c27e687c82f479624217c1dbddd Mon Sep 17 00:00:00 2001 From: jessib Date: Fri, 16 Nov 2012 15:43:12 -0800 Subject: Rough start to modeling tickets view after the issues view in github (so something like https://github.com/spree/spree/issues ), using bootstrap for display. Still want to use pjax, and have more functionality to add: searching, sorting, pagination, etc.. --- help/app/models/ticket.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'help/app/models') diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb index dc2f51b..3b66fe4 100644 --- a/help/app/models/ticket.rb +++ b/help/app/models/ticket.rb @@ -83,6 +83,19 @@ class Ticket < CouchRest::Model::Base #save end + def commenters + commenters = [] + self.comments.each do |comment| + if comment.posted_by + user = User.find(comment.posted_by) + commenters << user.login if user and !commenters.include?(user.login) + else + commenters << 'unauthenticated user' if !commenters.include?('unauthenticated user') #todo don't hardcode string 'unauthenticated user' + end + end + commenters.join(', ') + end + def comments_attributes=(attributes) if attributes # could be empty as we will empty if nothing was typed in comment = TicketComment.new(attributes.values.first) #TicketComment.new(attributes) -- cgit v1.2.3