Skip to content

Commit

Permalink
factoring out a base considerit mailer for later use in exception man…
Browse files Browse the repository at this point in the history
…agement and reporting

Former-commit-id: f4aec901cbc2bac77362d162fee6ec827538d7e8 [formerly 2b0c019e52d1acfae82ea2ef8ec8803fa0383ac2] [formerly bdfdabd68913e9d8d85c382e4e873d246c8ecb0b [formerly 70a644325bd2e34f59c6b7b49257b16c5d36c361]] [formerly 6ba1a5a7ae91a380b22772bc1be74cc732eba63b [formerly aa173515cdb2d805a89cf72eaee3dfa1fbd89e22] [formerly 7eea8f8d7dbb2f983d09424343fe84ed27e9ad40 [formerly 7eea8f8d7dbb2f983d09424343fe84ed27e9ad40 [formerly ac43c687b493e6ad737f422607c757550147dfda]]]]
Former-commit-id: 7fcf6b262f76d12b9afbfaffb0e1c53d4a2ab0d5 [formerly a0d05a1d11fbec227e928b9eb3394cea67799c5d] [formerly 82fe083e929a3147b64349efaffdf2de254dd6ad [formerly 716977ab954f65ab3afcb8f0130755308f9e686e]]
Former-commit-id: 346d57348cd325bdde2753ed223d8ca82641c683 [formerly dd3f3f3b79ea278798707b490eed41a34bcd42bc]
Former-commit-id: 4183a53b591b89c16407e9aeed9de302906d8d1e
Former-commit-id: 42ebae3
  • Loading branch information
tkriplean committed Mar 8, 2014
1 parent ae0be6d commit 409b5f8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 45 deletions.
14 changes: 1 addition & 13 deletions @server/mailers/alert_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'mail'

class AlertMailer < ActionMailer::Base
ActionMailer::Base.delivery_method = :mailhopper
layout 'email'
class AlertMailer < Mailer

#### MODERATION ####
def content_to_moderate(user, tenant)
Expand Down Expand Up @@ -36,15 +34,5 @@ def content_to_assess(assessment, user, tenant)

end

private

def format_email(addr, name = nil)
address = Mail::Address.new addr # ex: "john@example.com"
if name
address.display_name = name # ex: "John Doe"
end
# Set the From or Reply-To header to the following:
address.format # returns "John Doe <john@example.com>"

end
end
20 changes: 1 addition & 19 deletions @server/mailers/event_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
require 'mail'

class EventMailer < ActionMailer::Base

ActionMailer::Base.delivery_method = :mailhopper
layout 'email'
class EventMailer < Mailer

def send_message(message, current_user, options = {})
@message = message
Expand Down Expand Up @@ -119,20 +116,5 @@ def point_new_assessment(user, pnt, assessment, options, notification_type)
mail(:from => from, :to => email_with_name, :subject => "[#{options[:app_title]}] #{subject}")
end

#### OPINION LEVEL ####

private
def current_tenant
ApplicationController.find_current_tenant(request)
end

def format_email(addr, name = nil)
address = Mail::Address.new addr # ex: "john@example.com"
if name
address.display_name = name # ex: "John Doe"
end
# Set the From or Reply-To header to the following:
address.format # returns "John Doe <john@example.com>"

end
end
18 changes: 18 additions & 0 deletions @server/mailers/mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Mailer < ActionMailer::Base
ActionMailer::Base.delivery_method = :mailhopper
layout 'email'


private

def format_email(addr, name = nil)
address = Mail::Address.new addr # ex: "john@example.com"
if name
address.display_name = name # ex: "John Doe"
end
# Set the From or Reply-To header to the following:
address.format # returns "John Doe <john@example.com>"

end

end
14 changes: 1 addition & 13 deletions @server/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'mail'

class UserMailer < ActionMailer::Base
ActionMailer::Base.delivery_method = :mailhopper
layout 'email'
class UserMailer < Mailer
include Devise::Mailers::Helpers

######### DEVISE MAILERS
Expand Down Expand Up @@ -65,16 +63,6 @@ def invitation(email, proposal, notification_type, options )

private

def format_email(addr, name = nil)
address = Mail::Address.new addr # ex: "john@example.com"
if name
address.display_name = name # ex: "John Doe"
end
# Set the From or Reply-To header to the following:
address.format # returns "John Doe <john@example.com>"

end

# def generate_reset_password_token!(user)
# user.reset_password_token = User.reset_password_token
# user.reset_password_sent_at = Time.now.utc
Expand Down

0 comments on commit 409b5f8

Please sign in to comment.