diff options
Diffstat (limited to 'app/mailers')
| -rw-r--r-- | app/mailers/application_mailer.rb | 2 | ||||
| -rw-r--r-- | app/mailers/comment_mailer.rb | 16 | ||||
| -rw-r--r-- | app/mailers/quote_mailer.rb | 7 | ||||
| -rw-r--r-- | app/mailers/vote_mailer.rb | 9 |
4 files changed, 33 insertions, 1 deletions
| diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 286b223..4862159 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | class ApplicationMailer < ActionMailer::Base | 1 | class ApplicationMailer < ActionMailer::Base |
| 2 | default from: 'from@example.com' | 2 | default from: 'no-reply@fourisland.com' |
| 3 | layout 'mailer' | 3 | layout 'mailer' |
| 4 | end | 4 | end |
| diff --git a/app/mailers/comment_mailer.rb b/app/mailers/comment_mailer.rb new file mode 100644 index 0000000..41feede --- /dev/null +++ b/app/mailers/comment_mailer.rb | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | class CommentMailer < ApplicationMailer | ||
| 2 | def new_comment_email | ||
| 3 | @comment = params[:comment] | ||
| 4 | mail(to: @comment.blog.user.email, subject: "[Four Island] Comment on #{@comment.blog.title}") | ||
| 5 | end | ||
| 6 | |||
| 7 | def new_pending_comment_email | ||
| 8 | @comment = params[:comment] | ||
| 9 | mail(to: @comment.blog.user.email, subject: "[Four Island] Pending comment on #{@comment.blog.title}") | ||
| 10 | end | ||
| 11 | |||
| 12 | def reply_comment_email | ||
| 13 | @comment = params[:comment] | ||
| 14 | mail(to: @comment.reply_to.email, subject: "[Four Island] Reply to your comment on #{@comment.blog.title}") | ||
| 15 | end | ||
| 16 | end | ||
| diff --git a/app/mailers/quote_mailer.rb b/app/mailers/quote_mailer.rb new file mode 100644 index 0000000..1f3bddd --- /dev/null +++ b/app/mailers/quote_mailer.rb | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | class QuoteMailer < ApplicationMailer | ||
| 2 | def pending_quote_email | ||
| 3 | @quote = params[:quote] | ||
| 4 | # again, this is odd | ||
| 5 | mail(to: User.first.email, subject: "[Four Island] New quote pending moderation") | ||
| 6 | end | ||
| 7 | end | ||
| diff --git a/app/mailers/vote_mailer.rb b/app/mailers/vote_mailer.rb new file mode 100644 index 0000000..90d2868 --- /dev/null +++ b/app/mailers/vote_mailer.rb | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | class VoteMailer < ApplicationMailer | ||
| 2 | helper :votes | ||
| 3 | |||
| 4 | def daily_report_email | ||
| 5 | @entries = params[:votes].group_by { |v| "#{v.votable_type}_#{v.votable_id}" }.values | ||
| 6 | # weird way of getting the admin's email | ||
| 7 | mail to: User.first.email, subject: "[Four Island] You have upvotes!" | ||
| 8 | end | ||
| 9 | end | ||
