diff options
author | Alex Legler <alex@a3li.li> | 2011-03-18 12:58:40 +0100 |
---|---|---|
committer | Alex Legler <alex@a3li.li> | 2011-03-18 12:58:40 +0100 |
commit | c498aabdf8d85b29b96fdc135d8a774c62190d9c (patch) | |
tree | 16fbb2e7ccc7474d70711fb5b0d6201ab4e85181 /lib | |
parent | update icon (diff) | |
download | glsamaker-c498aabdf8d85b29b96fdc135d8a774c62190d9c.tar.gz glsamaker-c498aabdf8d85b29b96fdc135d8a774c62190d9c.tar.bz2 glsamaker-c498aabdf8d85b29b96fdc135d8a774c62190d9c.zip |
Finish mailing stuff
Diffstat (limited to 'lib')
-rw-r--r-- | lib/glsamaker/mail.rb | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/lib/glsamaker/mail.rb b/lib/glsamaker/mail.rb index 2d89644..d3ab36b 100644 --- a/lib/glsamaker/mail.rb +++ b/lib/glsamaker/mail.rb @@ -20,7 +20,7 @@ module Glsamaker User.find(:all, :conditions => 'id > 0').each do |rcpt| next unless rcpt.can_access? glsa - unless user.get_pref_category(:mail)[:edit] == false + unless rcpt.get_pref_category(:mail)[:edit] == false GlsaMailer.deliver_edit(rcpt, glsa, diff, user) end end @@ -35,11 +35,49 @@ module Glsamaker User.find(:all, :conditions => 'id > 0').each do |rcpt| next unless rcpt.can_access? glsa - unless user.get_pref_category(:mail)[:request] == false + unless rcpt.get_pref_category(:mail)[:request] == false GlsaMailer.deliver_request(rcpt, glsa, user) end end - end - + end + + def comment_notification(glsa, comment, user) + if GLSAMAKER_NO_EMAIL + Rails.logger.info "Not sending email." + return false + end + + rcpt = glsa.submitter + return unless rcpt.can_access? glsa + return if rcpt == user + + unless rcpt.get_pref_category(:mail)[:comment] == false + GlsaMailer.deliver_comment(rcpt, glsa, comment, user) + end + end + + def approval_notification(glsa) + if GLSAMAKER_NO_EMAIL + Rails.logger.info "Not sending email." + return false + end + + rcpt = glsa.submitter + return unless rcpt.can_access? glsa + + unless rcpt.get_pref_category(:mail)[:comment] == false + GlsaMailer.deliver_approval(rcpt, glsa) + end + end + + def send_text(text, subject, user, footer = true) + if GLSAMAKER_NO_EMAIL + Rails.logger.info "Not sending email." + return false + end + + GlsaMailer.deliver_text(user, subject, text, footer) + end + end end |