Adjusted email inputs to play nicely with sidekiq
This commit is contained in:
		
							parent
							
								
									46c8443bc6
								
							
						
					
					
						commit
						c56ecc0c7f
					
				| @ -8,44 +8,6 @@ class UserMailer < ActionMailer::Base | |||||||
| 
 | 
 | ||||||
| 	default from: "Bike!Bike! <noreply@bikebike.org>" | 	default from: "Bike!Bike! <noreply@bikebike.org>" | ||||||
| 
 | 
 | ||||||
| 	# Subject can be set in your I18n file at config/locales/en.yml |  | ||||||
| 	# with the following lookup: |  | ||||||
| 	# |  | ||||||
| 	#   en.user_mailer.activation_needed_email.subject |  | ||||||
| 	# |  | ||||||
| 	def activation_needed_email(email_address) |  | ||||||
| 		@greeting = "Hi" |  | ||||||
| 
 |  | ||||||
| 		mail to: email_address |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	# Subject can be set in your I18n file at config/locales/en.yml |  | ||||||
| 	# with the following lookup: |  | ||||||
| 	# |  | ||||||
| 	#   en.user_mailer.activation_success_email.subject |  | ||||||
| 	# |  | ||||||
| 	def activation_success_email |  | ||||||
| 		@greeting = "Hi" |  | ||||||
| 
 |  | ||||||
| 		mail to: "to@example.org" |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
|     def conference_registration_email(conference, data, conference_registration) |  | ||||||
|         @data = data |  | ||||||
|         @conference = conference |  | ||||||
|         @url = "https://bikebike.org"#UserMailer.default_url_options[:host] |  | ||||||
|         @confirmation_url = UserMailer.default_url_options[:host] + "/#{@conference.url}/register/confirm/#{conference_registration.confirmation_token}/".gsub(/\/\/+/, '/') |  | ||||||
|         mail to: data[:email], subject: (I18n.t 'register.email.registration.subject',"Please confirm your registration for #{conference.title}", vars: {:conference_title => conference.title}) |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
| 	def conference_registration_confirmed_email(conference, data, conference_registration) |  | ||||||
| 		@data = data |  | ||||||
| 		@conference = conference |  | ||||||
| 		@url = "https://bikebike.org"#UserMailer.default_url_options[:host] |  | ||||||
| 		@confirmation_url = UserMailer.default_url_options[:host] + "/#{@conference.url}/register/pay-registration/#{conference_registration.confirmation_token}/".gsub(/\/\/+/, '/') |  | ||||||
| 		mail to: data[:email], subject: (I18n.t 'register.email.registration_confirmed.subject',"Thanks for confirming your registration for #{conference.title}", vars: {:conference_title => conference.title}) |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	def email_confirmation(confirmation) | 	def email_confirmation(confirmation) | ||||||
| 		@confirmation = confirmation | 		@confirmation = confirmation | ||||||
| 		@subject = _'email.subject.confirm_email','Please confirm your email address' | 		@subject = _'email.subject.confirm_email','Please confirm your email address' | ||||||
| @ -53,9 +15,9 @@ class UserMailer < ActionMailer::Base | |||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	def registration_confirmation(registration) | 	def registration_confirmation(registration) | ||||||
| 		@registration = registration | 		@registration = ConferenceRegistration.find(registration) | ||||||
| 		@conference = Conference.find(@registration.conference_id) | 		@conference = @registration.conference | ||||||
| 		@user = User.find(@registration.user_id) | 		@user = @registration.user | ||||||
| 		@subject = @conference.registration_status.to_sym == :pre ? | 		@subject = @conference.registration_status.to_sym == :pre ? | ||||||
| 			_( | 			_( | ||||||
| 				'email.subject.pre_registration_confirmed', | 				'email.subject.pre_registration_confirmed', | ||||||
| @ -72,17 +34,18 @@ class UserMailer < ActionMailer::Base | |||||||
| 	def broadcast(host, subject, content, user, conference) | 	def broadcast(host, subject, content, user, conference) | ||||||
| 		@host = host | 		@host = host | ||||||
| 		@content = content | 		@content = content | ||||||
| 		@banner = nil#(@host || 'http://localhost/') + (conference ? (conference.poster.preview.url || '') : image_url('logo.png')) | 		@banner = nil | ||||||
|  | 		@conference = Conference.find(conference) | ||||||
|  | 		@user = Conference.find(user) if user.present? | ||||||
| 		@subject = "[#{conference ? conference.title : 'Bike!Bike!'}] #{subject}" | 		@subject = "[#{conference ? conference.title : 'Bike!Bike!'}] #{subject}" | ||||||
| 		if user && user.named_email | 		if @user && @user.named_email | ||||||
| 			email = user.named_email | 			mail to: @user.named_email, subject: @subject | ||||||
| 			mail to: email, subject: @subject |  | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	def workshop_facilitator_request(workshop, requester, message) | 	def workshop_facilitator_request(workshop, requester, message) | ||||||
| 		@workshop = workshop | 		@workshop = Workshop.find(workshop) | ||||||
| 		@requester = requester | 		@requester = User.find(requester) | ||||||
| 		addresses = [] | 		addresses = [] | ||||||
| 		@workshop.active_facilitators.each do |f| | 		@workshop.active_facilitators.each do |f| | ||||||
| 			addresses << f.named_email | 			addresses << f.named_email | ||||||
| @ -96,9 +59,9 @@ class UserMailer < ActionMailer::Base | |||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	def workshop_facilitator_request_approved(workshop, user) | 	def workshop_facilitator_request_approved(workshop, user) | ||||||
| 		@workshop = workshop | 		@workshop = Workshop.find(workshop) | ||||||
| 		@conference = Conference.find(@workshop.conference_id) | 		@conference = Conference.find(@workshop.conference_id) | ||||||
| 		@user = user | 		@user = User.find(user) | ||||||
| 		@subject = (_'email.subject.workshop_request_approved', | 		@subject = (_'email.subject.workshop_request_approved', | ||||||
| 					"You have been added as a facilitator of #{@workshop.title}", | 					"You have been added as a facilitator of #{@workshop.title}", | ||||||
| 					:vars => {:workshop_title => @workshop.title}) | 					:vars => {:workshop_title => @workshop.title}) | ||||||
| @ -106,9 +69,9 @@ class UserMailer < ActionMailer::Base | |||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	def workshop_facilitator_request_denied(workshop, user) | 	def workshop_facilitator_request_denied(workshop, user) | ||||||
| 		@workshop = workshop | 		@workshop = Workshop.find(workshop) | ||||||
| 		@conference = Conference.find(@workshop.conference_id) | 		@conference = @workshop.conference | ||||||
| 		@user = user | 		@user = User.find(user) | ||||||
| 		@subject = (_'email.subject.workshop_request_denied', | 		@subject = (_'email.subject.workshop_request_denied', | ||||||
| 					"Your request to facilitate #{@workshop.title} has been denied", | 					"Your request to facilitate #{@workshop.title} has been denied", | ||||||
| 					:vars => {:workshop_title => @workshop.title}) | 					:vars => {:workshop_title => @workshop.title}) | ||||||
| @ -116,12 +79,12 @@ class UserMailer < ActionMailer::Base | |||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	def workshop_translated(workshop, data, locale, user, translator) | 	def workshop_translated(workshop, data, locale, user, translator) | ||||||
| 		@workshop = workshop | 		@workshop = Workshop.find(workshop) | ||||||
| 		@data = data | 		@data = data | ||||||
| 		@locale = locale | 		@locale = locale | ||||||
| 		@locale_name = language_name(locale) | 		@locale_name = language_name(locale) | ||||||
| 		@user = user | 		@user = User.find(user) | ||||||
| 		@translator = translator | 		@translator = User.find(translator) | ||||||
| 		@subject = (_'email.subject.workshop_translated', | 		@subject = (_'email.subject.workshop_translated', | ||||||
| 					"The #{@locale_name} translation for #{@workshop.title} has been modified", | 					"The #{@locale_name} translation for #{@workshop.title} has been modified", | ||||||
| 					vars: {language: @language_name, workshop_title: @workshop.title}) | 					vars: {language: @language_name, workshop_title: @workshop.title}) | ||||||
| @ -139,10 +102,10 @@ class UserMailer < ActionMailer::Base | |||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	def workshop_original_content_changed(workshop, data, user, translator) | 	def workshop_original_content_changed(workshop, data, user, translator) | ||||||
| 		@workshop = workshop | 		@workshop = Workshop.find(workshop) | ||||||
| 		@data = data | 		@data = data | ||||||
| 		@user = user | 		@user = User.find(user) | ||||||
| 		@translator = translator | 		@translator = User.find(translator) | ||||||
| 		@subject = (_'email.subject.workshop_original_content_changed', | 		@subject = (_'email.subject.workshop_original_content_changed', | ||||||
| 					"Original content for #{@workshop.title} has been modified", | 					"Original content for #{@workshop.title} has been modified", | ||||||
| 					vars: {workshop_title: @workshop.title}) | 					vars: {workshop_title: @workshop.title}) | ||||||
| @ -160,9 +123,9 @@ class UserMailer < ActionMailer::Base | |||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	def workshop_comment(workshop, comment, user) | 	def workshop_comment(workshop, comment, user) | ||||||
| 		@workshop = workshop | 		@workshop = Workshop.find(workshop) | ||||||
| 		@comment = comment | 		@comment = comment | ||||||
| 		@user = user | 		@user = User.find(user) | ||||||
| 
 | 
 | ||||||
| 		if comment.reply? | 		if comment.reply? | ||||||
| 			@subject = (_'email.subject.workshop_comment.reply', vars: { user_name: comment.user.name }) | 			@subject = (_'email.subject.workshop_comment.reply', vars: { user_name: comment.user.name }) | ||||||
| @ -180,20 +143,20 @@ class UserMailer < ActionMailer::Base | |||||||
| 		@exception = exception | 		@exception = exception | ||||||
| 		@request = request | 		@request = request | ||||||
| 		@params = params | 		@params = params | ||||||
| 		@user = user | 		@user = User.find(user) | ||||||
| 		mail to: 'goodgodwin@hotmail.com', subject: @subject | 		mail to: 'goodgodwin@hotmail.com', subject: @subject | ||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	def contact(from, subject, message, email_list) | 	def contact(from, subject, message, email_list) | ||||||
| 		@message = message | 		@message = message | ||||||
| 		@from = from | 		@from = from.is_a?(Integer) ? User.find(from) : from | ||||||
| 
 | 
 | ||||||
| 		mail to: email_list.join(', '), subject: @subject, reply_to: from.is_a?(User) ? from.named_email : from | 		mail to: email_list.join(', '), subject: @subject, reply_to: from.is_a?(User) ? from.named_email : from | ||||||
| 	end | 	end | ||||||
| 
 | 
 | ||||||
| 	def contact_details(from, subject, message, request, params) | 	def contact_details(from, subject, message, request, params) | ||||||
| 		@message = message | 		@message = message | ||||||
| 		@from = from | 		@from = from.is_a?(Integer) ? User.find(from) : from | ||||||
| 		@request = request | 		@request = request | ||||||
| 		@params = params | 		@params = params | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -14,13 +14,13 @@ | |||||||
| 		%td=@from.is_a?(User) ? @from.email : @from | 		%td=@from.is_a?(User) ? @from.email : @from | ||||||
| 	%tr | 	%tr | ||||||
| 		%td IP Address | 		%td IP Address | ||||||
| 		%td=@request.remote_ip | 		%td=@request['remote_ip'] | ||||||
| 	%tr | 	%tr | ||||||
| 		%td UUID | 		%td UUID | ||||||
| 		%td=@request.uuid | 		%td=@request['uuid'] | ||||||
| 	%tr | 	%tr | ||||||
| 		%td URL | 		%td URL | ||||||
| 		%td=@request.original_url  | 		%td=@request['original_url']  | ||||||
| 
 | 
 | ||||||
| %h1 Message | %h1 Message | ||||||
| %blockquote=markdown(@message) | %blockquote=markdown(@message) | ||||||
| @ -32,15 +32,15 @@ | |||||||
| 		%th Value | 		%th Value | ||||||
| 	- @params.each do | key, value | | 	- @params.each do | key, value | | ||||||
| 		%tr | 		%tr | ||||||
| 			%td=key.to_s | 			%td=key | ||||||
| 			%td=value.to_s | 			%td=value | ||||||
| 
 | 
 | ||||||
| %h1 Request Environment | %h1 Request Environment | ||||||
| %table.error-report | %table.error-report | ||||||
| 	%tr | 	%tr | ||||||
| 		%th Key | 		%th Key | ||||||
| 		%th Value | 		%th Value | ||||||
| 	- @request.env.each do | key, value | | 	- @request['env'].each do | key, value | | ||||||
| 		%tr | 		%tr | ||||||
| 			%td=key.to_s | 			%td=key | ||||||
| 			%td=value.to_s | 			%td=value | ||||||
| @ -21,13 +21,13 @@ | |||||||
| 		%td=@user.present? ? @user.email : '' | 		%td=@user.present? ? @user.email : '' | ||||||
| 	%tr | 	%tr | ||||||
| 		%td IP Address | 		%td IP Address | ||||||
| 		%td=@request.remote_ip | 		%td=@request['remote_ip'] | ||||||
| 	%tr | 	%tr | ||||||
| 		%td UUID | 		%td UUID | ||||||
| 		%td=@request.uuid | 		%td=@request['uuid'] | ||||||
| 	%tr | 	%tr | ||||||
| 		%td URL | 		%td URL | ||||||
| 		%td=@request.original_url  | 		%td=@request['original_url']  | ||||||
| 
 | 
 | ||||||
| %h1 Params | %h1 Params | ||||||
| %table.error-report | %table.error-report | ||||||
| @ -36,15 +36,15 @@ | |||||||
| 		%th Value | 		%th Value | ||||||
| 	- @params.each do | key, value | | 	- @params.each do | key, value | | ||||||
| 		%tr | 		%tr | ||||||
| 			%td=key.to_s | 			%td=key | ||||||
| 			%td=value.to_s | 			%td=value | ||||||
| 
 | 
 | ||||||
| %h1 Request Environment | %h1 Request Environment | ||||||
| %table.error-report | %table.error-report | ||||||
| 	%tr | 	%tr | ||||||
| 		%th Key | 		%th Key | ||||||
| 		%th Value | 		%th Value | ||||||
| 	- @request.env.each do | key, value | | 	- @request['env'].each do | key, value | | ||||||
| 		%tr | 		%tr | ||||||
| 			%td=key.to_s | 			%td=key | ||||||
| 			%td=value.to_s | 			%td=value | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user