push commenters to RFC model

This commit is contained in:
Maximilian Grundke
2017-09-13 07:06:55 +02:00
parent 453d8fcb85
commit 4baab7430c
2 changed files with 10 additions and 5 deletions

View File

@ -68,11 +68,8 @@ class RequestForCommentsController < ApplicationController
def set_thank_you_note def set_thank_you_note
authorize! authorize!
@request_for_comment.thank_you_note = params[:note] @request_for_comment.thank_you_note = params[:note]
commenters = []
@request_for_comment.comments.distinct.to_a.each {|comment| commenters = @request_for_comment.commenters
commenters.append comment.user
}
commenters = commenters.uniq {|user| user.id}
commenters.each {|commenter| UserMailer.send_thank_you_note(@request_for_comment, commenter).deliver_now} commenters.each {|commenter| UserMailer.send_thank_you_note(@request_for_comment, commenter).deliver_now}
respond_to do |format| respond_to do |format|

View File

@ -38,6 +38,14 @@ class RequestForComment < ActiveRecord::Base
submission.files.map { |file| file.comments.size}.sum submission.files.map { |file| file.comments.size}.sum
end end
def commenters
commenters = []
comments.distinct.to_a.each {|comment|
commenters.append comment.user
}
commenters.uniq {|user| user.id}
end
def to_s def to_s
"RFC-" + self.id.to_s "RFC-" + self.id.to_s
end end