diff options
Diffstat (limited to 'help/app/models')
-rw-r--r-- | help/app/models/ticket.rb | 13 |
1 files changed, 13 insertions, 0 deletions
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) |