From e3e421cb7996efc3b2ded2f8d2ebd2b83a762733 Mon Sep 17 00:00:00 2001 From: Mark Lohr Date: Fri, 15 Sep 2017 13:40:21 -0400 Subject: [PATCH 1/5] fix email issue --- app/mailers/task_mailer.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/mailers/task_mailer.rb b/app/mailers/task_mailer.rb index 604b262c4..d094e2fc3 100644 --- a/app/mailers/task_mailer.rb +++ b/app/mailers/task_mailer.rb @@ -8,6 +8,7 @@ class TaskMailer < ApplicationMailer def task_confirmation(identity, task) @identity = identity @task = task - mail to: identity.email, subject: "(SPARCFulfillment) New Task Assigned" + env = ENV.fetch('environment') + mail to: env == 'testing' ? 'sparcrequest@gmail.com' : identity.email, subject: "(SPARCFulfillment) New Task Assigned" end end From 0f5a5a004a4bd075763eaebda9f1c13351dd8268 Mon Sep 17 00:00:00 2001 From: Mark Lohr Date: Fri, 15 Sep 2017 15:08:27 -0400 Subject: [PATCH 2/5] adding schema --- db/schema.rb | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 147e59498..0432614c1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -302,28 +302,6 @@ add_index "tasks", ["assignee_id"], name: "index_tasks_on_assignee_id", using: :btree add_index "tasks", ["identity_id"], name: "index_tasks_on_identity_id", using: :btree - create_table "users", force: :cascade do |t| - t.string "email", limit: 255, default: "", null: false - t.string "encrypted_password", limit: 255, default: "", null: false - t.string "reset_password_token", limit: 255 - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.integer "sign_in_count", limit: 4, default: 0, null: false - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip", limit: 255 - t.string "last_sign_in_ip", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" - t.string "first_name", limit: 255 - t.string "last_name", limit: 255 - t.string "time_zone", limit: 255, default: "Eastern Time (US & Canada)" - t.integer "tasks_count", limit: 4, default: 0 - end - - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree - create_table "versions", force: :cascade do |t| t.string "item_type", limit: 255, null: false t.integer "item_id", limit: 4, null: false From 454ff57d5b67fbfc53995703803f40c982f7cc9e Mon Sep 17 00:00:00 2001 From: Mark Lohr Date: Fri, 15 Sep 2017 16:16:16 -0400 Subject: [PATCH 3/5] localized email for testing env --- app/mailers/task_mailer.rb | 2 +- config/locales/en.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/mailers/task_mailer.rb b/app/mailers/task_mailer.rb index d094e2fc3..a69d814f7 100644 --- a/app/mailers/task_mailer.rb +++ b/app/mailers/task_mailer.rb @@ -9,6 +9,6 @@ def task_confirmation(identity, task) @identity = identity @task = task env = ENV.fetch('environment') - mail to: env == 'testing' ? 'sparcrequest@gmail.com' : identity.email, subject: "(SPARCFulfillment) New Task Assigned" + mail to: env == 'testing' ? {t(:task)[:test_email]} : identity.email, subject: "(SPARCFulfillment) New Task Assigned" end end diff --git a/config/locales/en.yml b/config/locales/en.yml index c80507f0c..c2d7214e3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -437,6 +437,8 @@ en: reschedule: "Reschedule" show_complete: "Complete " show_incomplete: "Incomplete " + test_email: "sparcrequest@gmail.com" + visit: object: "Visit" From 69604e5f15446f14be9e33b49acdaca29342deaf Mon Sep 17 00:00:00 2001 From: Mark Lohr Date: Mon, 18 Sep 2017 11:24:52 -0400 Subject: [PATCH 4/5] moved email from yml to env --- app/mailers/task_mailer.rb | 5 +++-- config/locales/en.yml | 2 -- dotenv.example | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/mailers/task_mailer.rb b/app/mailers/task_mailer.rb index a69d814f7..cb5eec11e 100644 --- a/app/mailers/task_mailer.rb +++ b/app/mailers/task_mailer.rb @@ -8,7 +8,8 @@ class TaskMailer < ApplicationMailer def task_confirmation(identity, task) @identity = identity @task = task - env = ENV.fetch('environment') - mail to: env == 'testing' ? {t(:task)[:test_email]} : identity.email, subject: "(SPARCFulfillment) New Task Assigned" + env = ENV.fetch('ENVIRONMENT') + test_email = ENV.fetch('TESTING_EMAIL') + mail to: env == 'testing' ? test_email : identity.email, subject: "(SPARCFulfillment) New Task Assigned" end end diff --git a/config/locales/en.yml b/config/locales/en.yml index c2d7214e3..c80507f0c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -437,8 +437,6 @@ en: reschedule: "Reschedule" show_complete: "Complete " show_incomplete: "Incomplete " - test_email: "sparcrequest@gmail.com" - visit: object: "Visit" diff --git a/dotenv.example b/dotenv.example index d379b4792..d5e454c55 100644 --- a/dotenv.example +++ b/dotenv.example @@ -42,3 +42,5 @@ LDAP_AUTH_PASSWORD= # add the following line if EPIC is turned off for your institution USE_EPIC=false USE_INDIRECT_COST=false +ENVIRONMENT=testing +TESTING_EMAIL=sparcrequest@gmail.com From 46c59aac737c784e9505592051aa1ddc9a5009e5 Mon Sep 17 00:00:00 2001 From: Mark Lohr Date: Mon, 18 Sep 2017 14:59:13 -0400 Subject: [PATCH 5/5] remove schema changes --- db/schema.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/db/schema.rb b/db/schema.rb index 0432614c1..147e59498 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -302,6 +302,28 @@ add_index "tasks", ["assignee_id"], name: "index_tasks_on_assignee_id", using: :btree add_index "tasks", ["identity_id"], name: "index_tasks_on_identity_id", using: :btree + create_table "users", force: :cascade do |t| + t.string "email", limit: 255, default: "", null: false + t.string "encrypted_password", limit: 255, default: "", null: false + t.string "reset_password_token", limit: 255 + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", limit: 4, default: 0, null: false + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip", limit: 255 + t.string "last_sign_in_ip", limit: 255 + t.datetime "created_at" + t.datetime "updated_at" + t.string "first_name", limit: 255 + t.string "last_name", limit: 255 + t.string "time_zone", limit: 255, default: "Eastern Time (US & Canada)" + t.integer "tasks_count", limit: 4, default: 0 + end + + add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree + add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree + create_table "versions", force: :cascade do |t| t.string "item_type", limit: 255, null: false t.integer "item_id", limit: 4, null: false