Skip to content

Instantly share code, notes, and snippets.

@marclove
Last active August 29, 2015 13:57
Show Gist options
  • Save marclove/9378682 to your computer and use it in GitHub Desktop.
Save marclove/9378682 to your computer and use it in GitHub Desktop.
class CommentCreator
#...
def perform
ThreadParticipantsNotifier.new(@comment).notify
if comment.previous_comment?
in_reply_to_user = comment.previous_comment.author
ReplyMailer.notification(in_reply_to_user, comment).deliver
end
Kissmetrics.record(comment.author, 'Added Comment')
end
end
class ThreadParticipantsNotifier
def initialize(comment)
@comment = comment
end
def notify
participants.each { |partipiant| notify_participant(participant) }
end
private
def notify_participant(participant)
CommentThreadMailer.activity_notification(comment_thread, comment, participant)
end
def participants
comment_thread.participants
end
def comment_thread
@comment.comment_thread
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment