Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
SuggestionMailer: Extract to address and change redirect after sending.
Browse files Browse the repository at this point in the history
References #42, #55.
  • Loading branch information
ybakos committed Jan 19, 2019
1 parent 6699911 commit 0fe07d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/suggestions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def create

if @suggestion.valid? and verify_recaptcha
SuggestionMailer.suggestion(current_user, suggestion_params).deliver
redirect_to root_path, notice: 'Thank you, your suggestion has been sent.'
redirect_to measures_url, notice: 'Thank you, your suggestion has been sent.'
else
flash[:recaptcha_error]
render :new
Expand Down
3 changes: 2 additions & 1 deletion app/mailers/suggestion_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
class SuggestionMailer < ApplicationMailer

default from: '[email protected]'
SUGGESTION_RECIPIENT_EMAIL = ENV['SUGGESTION_RECIPIENT_EMAIL']

def suggestion(user, suggestion_params)
@user = user
@suggestion = suggestion_params
mail(to: ENV['SUGGESTION_RECIPIENT_EMAIL'],
mail(to: SUGGESTION_RECIPIENT_EMAIL,
subject: 'TRACES Resilience Measure Suggestion'
)
end
Expand Down

0 comments on commit 0fe07d2

Please sign in to comment.