diff --git a/.env.sample b/.env.sample index e4c08d894..c0e0bbbd5 100644 --- a/.env.sample +++ b/.env.sample @@ -39,6 +39,12 @@ LOGIN_GOV_OPENID_CERT_URL='https://idp.int.identitysandbox.gov/api/openid_connec # For New Relic NEW_RELIC_KEY=YOUR-NEW-RELIC-KEY-HERE +# See: rails db:encryption:init +# Also see: rails credentials:help +RAILS_ACTIVE_RECORD_PRIMARY_KEY= +RAILS_ACTIVE_RECORD_DETERMINISTIC_KEY= +RAILS_ACTIVE_RECORD_KEY_DERIVATION_SALT= + # Redis cache store REDIS_URL=redis://localhost:6379/1 diff --git a/app/controllers/admin/digital_products_controller.rb b/app/controllers/admin/digital_products_controller.rb index ab58ad8a4..a446d51d8 100644 --- a/app/controllers/admin/digital_products_controller.rb +++ b/app/controllers/admin/digital_products_controller.rb @@ -163,11 +163,16 @@ def publish if @digital_product.publish! Event.log_event(Event.names[:digital_product_published], 'Digital Product', @digital_product.id, "Digital Product #{@digital_product.name} published at #{DateTime.now}", current_user.id) + @account_contacts = [] + if @digital_product.roles.first + @account_contacts = @digital_product.roles.first.users.collect(&:email) + end + UserMailer.notification( title: 'Digital Product has been published', body: "Digital Product #{@digital_product.name} published at #{DateTime.now} by #{current_user.email}", path: admin_digital_product_url(@digital_product), - emails: (User.admins.collect(&:email) + User.registry_managers.collect(&:email) + @digital_product.roles.first.users.collect(&:email)).uniq, + emails: (User.admins.collect(&:email) + User.registry_managers.collect(&:email) + @account_contacts).uniq, ).deliver_later redirect_to admin_digital_product_path(@digital_product), notice: "Digital Product #{@digital_product.name} was published." diff --git a/app/controllers/admin/digital_service_accounts_controller.rb b/app/controllers/admin/digital_service_accounts_controller.rb index 7666bc10a..b9602c81b 100644 --- a/app/controllers/admin/digital_service_accounts_controller.rb +++ b/app/controllers/admin/digital_service_accounts_controller.rb @@ -191,12 +191,17 @@ def publish 'Digital Service Account', @digital_service_account.id, "Digital Service Account #{@digital_service_account.name} published at #{DateTime.now}", current_user.id) - + + @account_contacts = [] + if @digital_service_account.roles.first + @account_contacts = @digital_service_account.roles.first.users.collect(&:email) + end + UserMailer.notification( title: 'Digital Service Account was published', body: "Digital Service Account #{@digital_service_account.name} published at #{DateTime.now} by #{current_user.email}", path: admin_digital_service_account_url(@digital_service_account), - emails: (User.admins.collect(&:email) + User.registry_managers.collect(&:email) + @digital_service_account.roles.first.users.collect(&:email)).uniq, + emails: (User.admins.collect(&:email) + User.registry_managers.collect(&:email) + @account_contacts).uniq ).deliver_later redirect_to admin_digital_service_account_path(@digital_service_account), notice: "Digital Service Account #{@digital_service_account.name} was published." diff --git a/app/models/user.rb b/app/models/user.rb index 168ae93f1..494c89d31 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class User < ApplicationRecord + encrypts :api_key, deterministic: true + rolify # Include default devise modules. Others available are: # :lockable diff --git a/app/views/admin/submissions/_responses_by_status.html.erb b/app/views/admin/submissions/_responses_by_status.html.erb index 0f517eca1..49aad95d7 100644 --- a/app/views/admin/submissions/_responses_by_status.html.erb +++ b/app/views/admin/submissions/_responses_by_status.html.erb @@ -1,4 +1 @@ - <%= render 'components/responses_by_status', submissions: form.submissions %> diff --git a/app/views/admin/submissions/_submissions.html.erb b/app/views/admin/submissions/_submissions.html.erb index 04eb5bd95..88abef26b 100644 --- a/app/views/admin/submissions/_submissions.html.erb +++ b/app/views/admin/submissions/_submissions.html.erb @@ -15,7 +15,7 @@ Filter by tag