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, | 					request, | ||||||
| 					params, | 					params, | ||||||
| 					current_user, | 					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? | ||||||
| 		rescue exception2 | 		rescue exception2 | ||||||
| @ -218,8 +219,9 @@ class ApplicationController < LinguaFrancaApplicationController | |||||||
| 					request, | 					request, | ||||||
| 					params, | 					params, | ||||||
| 					current_user, | 					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 | 		end | ||||||
| 
 | 
 | ||||||
| 		# raise the error if we are in development so that we can debug it | 		# 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) | 		if object.respond_to?(:get_translators) | ||||||
| 			object.get_translators(data, locale).each do |id, user| | 			object.get_translators(data, locale).each do |id, user| | ||||||
| 				if user.id != current_user.id && user.id != translator_id | 				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] } | 						{ :args => [object, data, locale, user, translator] } | ||||||
| 					end | 					end | ||||||
| 				end | 				end | ||||||
| @ -417,7 +419,7 @@ class ApplicationController < LinguaFrancaApplicationController | |||||||
| 		if object.respond_to?(:get_translators) | 		if object.respond_to?(:get_translators) | ||||||
| 			object.get_translators(data).each do |id, user| | 			object.get_translators(data).each do |id, user| | ||||||
| 				if user.id != current_user.id | 				if user.id != current_user.id | ||||||
| 					UserMailer.send_mail mailer do | 					UserMailer.send_mail mailer, user.locale do | ||||||
| 						{ :args => [object, data, user, current_user] } | 						{ :args => [object, data, user, current_user] } | ||||||
| 					end | 					end | ||||||
| 				end | 				end | ||||||
| @ -440,6 +442,7 @@ class ApplicationController < LinguaFrancaApplicationController | |||||||
| 					request, | 					request, | ||||||
| 					params, | 					params, | ||||||
| 					current_user, | 					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? | ||||||
| 		rescue exception2 | 		rescue exception2 | ||||||
|  | |||||||
| @ -1614,10 +1614,8 @@ class ConferencesController < ApplicationController | |||||||
| 						workshop.id, user_id) | 						workshop.id, user_id) | ||||||
| 				f.role = :collaborator | 				f.role = :collaborator | ||||||
| 				f.save | 				f.save | ||||||
| 				UserMailer.send_mail :workshop_facilitator_request_approved do | 				UserMailer.send_mail :workshop_facilitator_request_approved, user.locale do | ||||||
| 					{ | 					[ workshop, user ] | ||||||
| 						:args => [ workshop, user ] |  | ||||||
| 					} |  | ||||||
| 				end | 				end | ||||||
| 				return redirect_to view_workshop_url(@this_conference.slug, workshop.id)		 | 				return redirect_to view_workshop_url(@this_conference.slug, workshop.id)		 | ||||||
| 			end | 			end | ||||||
| @ -1626,10 +1624,8 @@ class ConferencesController < ApplicationController | |||||||
| 				WorkshopFacilitator.delete_all( | 				WorkshopFacilitator.delete_all( | ||||||
| 					:workshop_id => workshop.id, | 					:workshop_id => workshop.id, | ||||||
| 					:user_id => user_id) | 					:user_id => user_id) | ||||||
| 				UserMailer.send_mail :workshop_facilitator_request_denied do | 				UserMailer.send_mail :workshop_facilitator_request_denied, user.locale do | ||||||
| 					{ | 					[ workshop, user ] | ||||||
| 						:args => [ workshop, user ] |  | ||||||
| 					} |  | ||||||
| 				end | 				end | ||||||
| 				return redirect_to view_workshop_url(@this_conference.slug, workshop.id)		 | 				return redirect_to view_workshop_url(@this_conference.slug, workshop.id)		 | ||||||
| 			end | 			end | ||||||
| @ -1669,10 +1665,8 @@ class ConferencesController < ApplicationController | |||||||
| 		unless workshop.facilitator?(user) | 		unless workshop.facilitator?(user) | ||||||
| 			WorkshopFacilitator.create(user_id: user.id, workshop_id: workshop.id, role: :collaborator) | 			WorkshopFacilitator.create(user_id: user.id, workshop_id: workshop.id, role: :collaborator) | ||||||
| 			 | 			 | ||||||
| 			UserMailer.send_mail :workshop_facilitator_request_approved do | 			UserMailer.send_mail :workshop_facilitator_request_approved, user.locale do | ||||||
| 				{ | 				[ workshop, user ] | ||||||
| 					:args => [ workshop, user ] |  | ||||||
| 				} |  | ||||||
| 			end | 			end | ||||||
| 		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) | 			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]) | 			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 ] | 				[ workshop, new_comment, comment.user ] | ||||||
| 			end | 			end | ||||||
| 		elsif params[:button] = 'add_comment' | 		elsif params[:button] = 'add_comment' | ||||||
| 			new_comment = workshop.add_comment(current_user, params[:comment]) | 			new_comment = workshop.add_comment(current_user, params[:comment]) | ||||||
| 
 | 
 | ||||||
| 			workshop.active_facilitators.each do | u | | 			workshop.active_facilitators.each do | u | | ||||||
| 				UserMailer.send_mail :workshop_comment do | 				UserMailer.send_mail :workshop_comment, u.locale do | ||||||
| 					[ workshop, new_comment, u ] | 					[ workshop, new_comment, u ] | ||||||
| 				end | 				end | ||||||
| 			end | 			end | ||||||
|  | |||||||
| @ -129,13 +129,14 @@ class UserMailer < ActionMailer::Base | |||||||
| 		mail to: @user.named_email, subject: @subject | 		mail to: @user.named_email, subject: @subject | ||||||
| 	end | 	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 | 		@subject = subject | ||||||
| 		@message = message | 		@message = message | ||||||
| 		@report = report | 		@report = report | ||||||
| 		@exception = exception | 		@exception = exception | ||||||
| 		@request = request | 		@request = request | ||||||
| 		@params = params | 		@params = params | ||||||
|  | 		@time = time | ||||||
| 		@user = User.find(user) if user.present? | 		@user = User.find(user) if user.present? | ||||||
| 		mail to: 'goodgodwin@hotmail.com', subject: @subject | 		mail to: 'goodgodwin@hotmail.com', subject: @subject | ||||||
| 	end | 	end | ||||||
|  | |||||||
| @ -28,6 +28,9 @@ | |||||||
| 	%tr | 	%tr | ||||||
| 		%td URL | 		%td URL | ||||||
| 		%td=@request['original_url']  | 		%td=@request['original_url']  | ||||||
|  | 	%tr | ||||||
|  | 		%td Time | ||||||
|  | 		%td=@time | ||||||
| 
 | 
 | ||||||
| %h1 Params | %h1 Params | ||||||
| %table.error-report | %table.error-report | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user