Added time to error report and translated emails into recipients locale instead of senders
This commit is contained in:
		
							parent
							
								
									553e412685
								
							
						
					
					
						commit
						44c103f3d1
					
				| @ -158,6 +158,7 @@ class ApplicationController < LinguaFrancaApplicationController | ||||
| 					request, | ||||
| 					params, | ||||
| 					current_user, | ||||
| 					Time.now.strftime("%d/%m/%Y %H:%M") | ||||
| 				] | ||||
| 			end if Rails.env.preview? || Rails.env.production? | ||||
| 		rescue exception2 | ||||
| @ -218,8 +219,9 @@ class ApplicationController < LinguaFrancaApplicationController | ||||
| 					request, | ||||
| 					params, | ||||
| 					current_user, | ||||
| 					Time.now.strftime("%d/%m/%Y %H:%M") | ||||
| 				] | ||||
| 			end if Rails.env.preview? || Rails.env.production? | ||||
| 			end# if Rails.env.preview? || Rails.env.production? | ||||
| 		end | ||||
| 
 | ||||
| 		# raise the error if we are in development so that we can debug it | ||||
| @ -403,7 +405,7 @@ class ApplicationController < LinguaFrancaApplicationController | ||||
| 		if object.respond_to?(:get_translators) | ||||
| 			object.get_translators(data, locale).each do |id, user| | ||||
| 				if user.id != current_user.id && user.id != translator_id | ||||
| 					UserMailer.send_mail mailer do | ||||
| 					UserMailer.send_mail mailer, user.locale do | ||||
| 						{ :args => [object, data, locale, user, translator] } | ||||
| 					end | ||||
| 				end | ||||
| @ -417,7 +419,7 @@ class ApplicationController < LinguaFrancaApplicationController | ||||
| 		if object.respond_to?(:get_translators) | ||||
| 			object.get_translators(data).each do |id, user| | ||||
| 				if user.id != current_user.id | ||||
| 					UserMailer.send_mail mailer do | ||||
| 					UserMailer.send_mail mailer, user.locale do | ||||
| 						{ :args => [object, data, user, current_user] } | ||||
| 					end | ||||
| 				end | ||||
| @ -440,6 +442,7 @@ class ApplicationController < LinguaFrancaApplicationController | ||||
| 					request, | ||||
| 					params, | ||||
| 					current_user, | ||||
| 					Time.now.strftime("%d/%m/%Y %H:%M") | ||||
| 				] | ||||
| 			end if Rails.env.preview? || Rails.env.production? | ||||
| 		rescue exception2 | ||||
|  | ||||
| @ -1614,10 +1614,8 @@ class ConferencesController < ApplicationController | ||||
| 						workshop.id, user_id) | ||||
| 				f.role = :collaborator | ||||
| 				f.save | ||||
| 				UserMailer.send_mail :workshop_facilitator_request_approved do | ||||
| 					{ | ||||
| 						:args => [ workshop, user ] | ||||
| 					} | ||||
| 				UserMailer.send_mail :workshop_facilitator_request_approved, user.locale do | ||||
| 					[ workshop, user ] | ||||
| 				end | ||||
| 				return redirect_to view_workshop_url(@this_conference.slug, workshop.id)		 | ||||
| 			end | ||||
| @ -1626,10 +1624,8 @@ class ConferencesController < ApplicationController | ||||
| 				WorkshopFacilitator.delete_all( | ||||
| 					:workshop_id => workshop.id, | ||||
| 					:user_id => user_id) | ||||
| 				UserMailer.send_mail :workshop_facilitator_request_denied do | ||||
| 					{ | ||||
| 						:args => [ workshop, user ] | ||||
| 					} | ||||
| 				UserMailer.send_mail :workshop_facilitator_request_denied, user.locale do | ||||
| 					[ workshop, user ] | ||||
| 				end | ||||
| 				return redirect_to view_workshop_url(@this_conference.slug, workshop.id)		 | ||||
| 			end | ||||
| @ -1669,10 +1665,8 @@ class ConferencesController < ApplicationController | ||||
| 		unless workshop.facilitator?(user) | ||||
| 			WorkshopFacilitator.create(user_id: user.id, workshop_id: workshop.id, role: :collaborator) | ||||
| 			 | ||||
| 			UserMailer.send_mail :workshop_facilitator_request_approved do | ||||
| 				{ | ||||
| 					:args => [ workshop, user ] | ||||
| 				} | ||||
| 			UserMailer.send_mail :workshop_facilitator_request_approved, user.locale do | ||||
| 				[ workshop, user ] | ||||
| 			end | ||||
| 		end | ||||
| 
 | ||||
| @ -1690,14 +1684,14 @@ class ConferencesController < ApplicationController | ||||
| 			comment = Comment.find_by!(id: params[:comment_id].to_i, model_type: :workshops, model_id: workshop.id) | ||||
| 			new_comment = comment.add_comment(current_user, params[:reply]) | ||||
| 
 | ||||
| 			UserMailer.send_mail :workshop_comment do | ||||
| 			UserMailer.send_mail :workshop_comment, comment.user.locale do | ||||
| 				[ workshop, new_comment, comment.user ] | ||||
| 			end | ||||
| 		elsif params[:button] = 'add_comment' | ||||
| 			new_comment = workshop.add_comment(current_user, params[:comment]) | ||||
| 
 | ||||
| 			workshop.active_facilitators.each do | u | | ||||
| 				UserMailer.send_mail :workshop_comment do | ||||
| 				UserMailer.send_mail :workshop_comment, u.locale do | ||||
| 					[ workshop, new_comment, u ] | ||||
| 				end | ||||
| 			end | ||||
|  | ||||
| @ -129,13 +129,14 @@ class UserMailer < ActionMailer::Base | ||||
| 		mail to: @user.named_email, subject: @subject | ||||
| 	end | ||||
| 
 | ||||
| 	def error_report(subject, message, report, exception, request, params, user) | ||||
| 	def error_report(subject, message, report, exception, request, params, user, time = nil) | ||||
| 		@subject = subject | ||||
| 		@message = message | ||||
| 		@report = report | ||||
| 		@exception = exception | ||||
| 		@request = request | ||||
| 		@params = params | ||||
| 		@time = time | ||||
| 		@user = User.find(user) if user.present? | ||||
| 		mail to: 'goodgodwin@hotmail.com', subject: @subject | ||||
| 	end | ||||
|  | ||||
| @ -28,6 +28,9 @@ | ||||
| 	%tr | ||||
| 		%td URL | ||||
| 		%td=@request['original_url']  | ||||
| 	%tr | ||||
| 		%td Time | ||||
| 		%td=@time | ||||
| 
 | ||||
| %h1 Params | ||||
| %table.error-report | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user