forked from beautyjoy/BJC-Teacher-Tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from cs169/187044314-add-to-field
187044314 add to field
- Loading branch information
Showing
12 changed files
with
118 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class AddToFieldToEmailTemplate < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :email_templates, :to, :string | ||
#below is the default prepopulated 'to' field value, | ||
to_field = "{{teacher_email}}, {{teacher_personal_email}}" | ||
EmailTemplate.update_all(to: to_field) | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20240220192015_change_to_field_for_form_submission.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ChangeToFieldForFormSubmission < ActiveRecord::Migration[6.1] | ||
def change | ||
EmailTemplate.find_by(path: "teacher_mailer/form_submission").update(to: "[email protected], [email protected]") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,9 +82,12 @@ module SeedData | |
REQUEST_INFO_EMAIL | ||
|
||
|
||
@default_to_field = "{{teacher_email}}, {{teacher_personal_email}}" | ||
|
||
def self.emails | ||
[ | ||
{ | ||
to: @default_to_field, | ||
body: @welcome_email, | ||
path: "teacher_mailer/welcome_email", | ||
locale: nil, | ||
|
@@ -96,6 +99,7 @@ def self.emails | |
subject: "Welcome to The Beauty and Joy of Computing!" | ||
}, | ||
{ | ||
to: "[email protected], [email protected]", | ||
body: @form_submission, | ||
path: "teacher_mailer/form_submission", | ||
locale: nil, | ||
|
@@ -107,6 +111,7 @@ def self.emails | |
subject: "Form Submission" | ||
}, | ||
{ | ||
to: @default_to_field, | ||
body: @deny_email, | ||
path: "teacher_mailer/deny_email", | ||
locale: nil, | ||
|
@@ -119,6 +124,7 @@ def self.emails | |
}, | ||
{ | ||
body: @request_info_email, | ||
to: @default_to_field, | ||
path: "teacher_mailer/request_info_email", | ||
locale: nil, | ||
handler: "liquid", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,3 +96,16 @@ reimu: | |
school: berkeley | ||
application_status: Info Needed | ||
education_level: -1 | ||
|
||
barney: | ||
id: 6 | ||
first_name: Barney | ||
last_name: Dinosaur | ||
snap: barney | ||
email: '[email protected]' | ||
personal_email: '[email protected]' | ||
status: 1 | ||
more_info: '' | ||
application_status: Denied | ||
school: berkeley | ||
education_level: -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,17 @@ | |
expect(email.body.encoded).to include("Hi Bob") | ||
end | ||
|
||
it "Sends to Both School and Personal Email When Possible" do | ||
teacher = teachers(:barney) | ||
email = TeacherMailer.welcome_email(teacher) | ||
email.deliver_now | ||
expect(email.from[0]).to eq("[email protected]") | ||
expect(email.to[0]).to eq("[email protected]") | ||
expect(email.to[1]).to eq("[email protected]") | ||
expect(email.subject).to eq("Welcome to The Beauty and Joy of Computing!") | ||
expect(email.body.encoded).to include("Hi Barney") | ||
end | ||
|
||
|
||
it "Sends Deny Email" do | ||
teacher = teachers(:long) | ||
|