diff --git a/app/controllers/admin/ivn_components_controller.rb b/app/controllers/admin/ivn_components_controller.rb deleted file mode 100644 index 321ab95a8..000000000 --- a/app/controllers/admin/ivn_components_controller.rb +++ /dev/null @@ -1,70 +0,0 @@ -class Admin::IvnComponentsController < AdminController - before_action :set_ivn_component, only: %i[ show edit update destroy ] - - # GET /admin/ivn_components or /admin/ivn_components.json - def index - @ivn_components = IvnComponent.all - end - - # GET /admin/ivn_components/1 or /admin/ivn_components/1.json - def show - end - - # GET /admin/ivn_components/new - def new - @ivn_component = IvnComponent.new - end - - # GET /admin/ivn_components/1/edit - def edit - end - - # POST /admin/ivn_components or /admin/ivn_components.json - def create - @ivn_component = IvnComponent.new(ivn_component_params) - - respond_to do |format| - if @ivn_component.save - format.html { redirect_to admin_ivn_component_url(@ivn_component), notice: "Ivn component was successfully created." } - format.json { render :show, status: :created, location: @ivn_component } - else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @ivn_component.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /admin/ivn_components/1 or /admin/ivn_components/1.json - def update - respond_to do |format| - if @ivn_component.update(ivn_component_params) - format.html { redirect_to admin_ivn_component_url(@ivn_component), notice: "Ivn component was successfully updated." } - format.json { render :show, status: :ok, location: @ivn_component } - else - format.html { render :edit, status: :unprocessable_entity } - format.json { render json: @ivn_component.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /admin/ivn_components/1 or /admin/ivn_components/1.json - def destroy - @ivn_component.destroy - - respond_to do |format| - format.html { redirect_to admin_ivn_components_url, notice: "Ivn component was successfully destroyed." } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_ivn_component - @ivn_component = IvnComponent.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def ivn_component_params - params.require(:ivn_component).permit(:name, :description, :url) - end -end diff --git a/app/controllers/admin/ivn_links_controller.rb b/app/controllers/admin/ivn_links_controller.rb deleted file mode 100644 index a9a37a795..000000000 --- a/app/controllers/admin/ivn_links_controller.rb +++ /dev/null @@ -1,70 +0,0 @@ -class Admin::IvnLinksController < AdminController - before_action :set_ivn_link, only: %i[ show edit update destroy ] - - # GET /admin/ivn_links or /admin/ivn_links.json - def index - @ivn_links = IvnLink.all - end - - # GET /admin/ivn_links/1 or /admin/ivn_links/1.json - def show - end - - # GET /admin/ivn_links/new - def new - @ivn_link = IvnLink.new - end - - # GET /admin/ivn_links/1/edit - def edit - end - - # POST /admin/ivn_links or /admin/ivn_links.json - def create - @ivn_link = IvnLink.new(ivn_link_params) - - respond_to do |format| - if @ivn_link.save - format.html { redirect_to admin_ivn_link_url(@ivn_link), notice: "Ivn link was successfully created." } - format.json { render :show, status: :created, location: @ivn_link } - else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @ivn_link.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /admin/ivn_links/1 or /admin/ivn_links/1.json - def update - respond_to do |format| - if @ivn_link.update(ivn_link_params) - format.html { redirect_to admin_ivn_link_url(@ivn_link), notice: "Ivn link was successfully updated." } - format.json { render :show, status: :ok, location: @ivn_link } - else - format.html { render :edit, status: :unprocessable_entity } - format.json { render json: @ivn_link.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /admin/ivn_links/1 or /admin/ivn_links/1.json - def destroy - @ivn_link.destroy - - respond_to do |format| - format.html { redirect_to admin_ivn_links_url, notice: "Ivn link was successfully destroyed." } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_ivn_link - @ivn_link = IvnLink.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def ivn_link_params - params.require(:ivn_link).permit(:from_id, :to_id) - end -end diff --git a/app/controllers/admin/ivn_source_component_links_controller.rb b/app/controllers/admin/ivn_source_component_links_controller.rb deleted file mode 100644 index e7eed5c03..000000000 --- a/app/controllers/admin/ivn_source_component_links_controller.rb +++ /dev/null @@ -1,70 +0,0 @@ -class Admin::IvnSourceComponentLinksController < AdminController - before_action :set_ivn_source_component_link, only: %i[ show edit update destroy ] - - # GET /admin/ivn_source_component_links or /admin/ivn_source_component_links.json - def index - @ivn_source_component_links = IvnSourceComponentLink.all - end - - # GET /admin/ivn_source_component_links/1 or /admin/ivn_source_component_links/1.json - def show - end - - # GET /admin/ivn_source_component_links/new - def new - @ivn_source_component_link = IvnSourceComponentLink.new - end - - # GET /admin/ivn_source_component_links/1/edit - def edit - end - - # POST /admin/ivn_source_component_links or /admin/ivn_source_component_links.json - def create - @ivn_source_component_link = IvnSourceComponentLink.new(ivn_source_component_link_params) - - respond_to do |format| - if @ivn_source_component_link.save - format.html { redirect_to admin_ivn_source_component_link_url(@ivn_source_component_link), notice: "Ivn source component link was successfully created." } - format.json { render :show, status: :created, location: @ivn_source_component_link } - else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @ivn_source_component_link.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /admin/ivn_source_component_links/1 or /admin/ivn_source_component_links/1.json - def update - respond_to do |format| - if @ivn_source_component_link.update(ivn_source_component_link_params) - format.html { redirect_to admin_ivn_source_component_link_url(@ivn_source_component_link), notice: "Ivn source component link was successfully updated." } - format.json { render :show, status: :ok, location: @ivn_source_component_link } - else - format.html { render :edit, status: :unprocessable_entity } - format.json { render json: @ivn_source_component_link.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /admin/ivn_source_component_links/1 or /admin/ivn_source_component_links/1.json - def destroy - @ivn_source_component_link.destroy - - respond_to do |format| - format.html { redirect_to admin_ivn_source_component_links_url, notice: "Ivn source component link was successfully destroyed." } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_ivn_source_component_link - @ivn_source_component_link = IvnSourceComponentLink.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def ivn_source_component_link_params - params.require(:ivn_source_component_link).permit(:from_id, :to_id) - end -end diff --git a/app/controllers/admin/ivn_sources_controller.rb b/app/controllers/admin/ivn_sources_controller.rb deleted file mode 100644 index 48a9eed05..000000000 --- a/app/controllers/admin/ivn_sources_controller.rb +++ /dev/null @@ -1,75 +0,0 @@ -class Admin::IvnSourcesController < AdminController - before_action :set_ivn_source, only: %i[ show edit update destroy ] - - # GET /admin/ivn_sources or /admin/ivn_sources.json - def index - @ivn_sources = IvnSource.all - end - - # GET /admin/ivn_sources/1 or /admin/ivn_sources/1.json - def show - end - - # GET /admin/ivn_sources/new - def new - @ivn_source = IvnSource.new - end - - # GET /admin/ivn_sources/1/edit - def edit - end - - # POST /admin/ivn_sources or /admin/ivn_sources.json - def create - @ivn_source = IvnSource.new(ivn_source_params) - - respond_to do |format| - if @ivn_source.save - format.html { redirect_to admin_ivn_source_url(@ivn_source), notice: "Ivn source was successfully created." } - format.json { render :show, status: :created, location: @ivn_source } - else - format.html { render :new, status: :unprocessable_entity } - format.json { render json: @ivn_source.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /admin/ivn_sources/1 or /admin/ivn_sources/1.json - def update - respond_to do |format| - if @ivn_source.update(ivn_source_params) - format.html { redirect_to admin_ivn_source_url(@ivn_source), notice: "Ivn source was successfully updated." } - format.json { render :show, status: :ok, location: @ivn_source } - else - format.html { render :edit, status: :unprocessable_entity } - format.json { render json: @ivn_source.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /admin/ivn_sources/1 or /admin/ivn_sources/1.json - def destroy - @ivn_source.destroy - - respond_to do |format| - format.html { redirect_to admin_ivn_sources_url, notice: "Ivn source was successfully destroyed." } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_ivn_source - @ivn_source = IvnSource.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def ivn_source_params - params.require(:ivn_source).permit( - :name, - :description, - :url, - :organization_id - ) - end -end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 7710fddb5..b19749395 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -40,6 +40,8 @@ def form_feedback(form_id:, email:) def submission_notification(submission_id:, emails: []) set_logo emails_to_notify = User.where(email: emails).select { |user| !user.inactive }.collect(&:email) + return false if emails_to_notify.empty? + @submission = Submission.find(submission_id) @form = @submission.form mail subject: "New Submission to #{@form.name}", diff --git a/app/models/ivn_component.rb b/app/models/ivn_component.rb deleted file mode 100644 index 5181262e8..000000000 --- a/app/models/ivn_component.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -class IvnComponent < ApplicationRecord - has_many :ivn_component_links, foreign_key: :to_id - has_many :ivn_components, through: :ivn_component_links -end diff --git a/app/models/ivn_component_link.rb b/app/models/ivn_component_link.rb deleted file mode 100644 index fe3ee4da7..000000000 --- a/app/models/ivn_component_link.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -class IvnComponentLink < ApplicationRecord - belongs_to :ivn_component, primary_key: :id, foreign_key: :from_id - belongs_to :to_ivn_component, primary_key: :id, foreign_key: :to_id, class_name: 'IvnComponent' -end diff --git a/app/models/ivn_source.rb b/app/models/ivn_source.rb deleted file mode 100644 index 81d1740a4..000000000 --- a/app/models/ivn_source.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class IvnSource < ApplicationRecord - belongs_to :organization - has_many :ivn_links - has_many :ivn_components, through: :ivn_links -end diff --git a/app/models/ivn_source_component_link.rb b/app/models/ivn_source_component_link.rb deleted file mode 100644 index 9db145ac3..000000000 --- a/app/models/ivn_source_component_link.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -class IvnSourceComponentLink < ApplicationRecord - belongs_to :ivn_source, foreign_key: :from_id - belongs_to :ivn_component, foreign_key: :to_id -end diff --git a/app/serializers/admin/ivn_link_serializer.rb b/app/serializers/admin/ivn_link_serializer.rb deleted file mode 100644 index d8065e85d..000000000 --- a/app/serializers/admin/ivn_link_serializer.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -module Admin - class IvnLinkSerializer < ActiveModel::Serializer - attributes :id, :from_id, :to_id - end -end diff --git a/app/serializers/admin/ivn_source_component_link_serializer.rb b/app/serializers/admin/ivn_source_component_link_serializer.rb deleted file mode 100644 index 4a87e79a7..000000000 --- a/app/serializers/admin/ivn_source_component_link_serializer.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -module Admin - class IvnSourceComponentLinkSerializer < ActiveModel::Serializer - attributes :id, :from_id, :to_id - end -end diff --git a/app/serializers/ivn_component_serializer.rb b/app/serializers/ivn_component_serializer.rb deleted file mode 100644 index 24f97df38..000000000 --- a/app/serializers/ivn_component_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -class IvnComponentSerializer < ActiveModel::Serializer - attributes :id, :name, :description, :url -end diff --git a/app/serializers/ivn_source_serializer.rb b/app/serializers/ivn_source_serializer.rb deleted file mode 100644 index dda3cca18..000000000 --- a/app/serializers/ivn_source_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -class IvnSourceSerializer < ActiveModel::Serializer - attributes :id, :name, :description, :url -end diff --git a/app/views/admin/ivn_components/_form.html.erb b/app/views/admin/ivn_components/_form.html.erb deleted file mode 100644 index 1786a85c1..000000000 --- a/app/views/admin/ivn_components/_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<%= form_with(model: ivn_component, url: (ivn_component.persisted? ? admin_ivn_component_path(ivn_component) : admin_ivn_components_path), data: { turbo: false }) do |form| %> - <%- if ivn_component.errors.any? %> -
-

<%= pluralize(ivn_component.errors.count, "error") %> prohibited this ivn_component from being saved:

- - -
- <% end %> - -
- <%= form.label :name, class: "usa-label" %> - <%= form.text_field :name, class: "usa-input" %> -
- -
- <%= form.label :url, class: "usa-label" %> - <%= form.text_field :url, class: "usa-input" %> -
- -
- <%= form.label :description, class: "usa-label" %> - <%= form.text_area :description, class: "usa-textarea" %> -
- -

- <%= form.submit class: "usa-button" %> -

-<% end %> diff --git a/app/views/admin/ivn_components/_ivn_component.html.erb b/app/views/admin/ivn_components/_ivn_component.html.erb deleted file mode 100644 index a7891549a..000000000 --- a/app/views/admin/ivn_components/_ivn_component.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -
-

- Name: - <%= ivn_component.name %> -

- -

- Description: - <%= ivn_component.description %> -

- -

- Url: - <%= ivn_component.url %> -

- -
diff --git a/app/views/admin/ivn_components/edit.html.erb b/app/views/admin/ivn_components/edit.html.erb deleted file mode 100644 index 3d95e382d..000000000 --- a/app/views/admin/ivn_components/edit.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -

Editing ivn component

- -<%= render "form", ivn_component: @ivn_component %> - -
- -
- <%= link_to "Show this ivn component", [:admin, @ivn_component] %> | - <%= link_to "Back to ivn components", admin_ivn_components_path %> - <%= button_to "Destroy this ivn component" , [:admin, @ivn_component], method: :delete %> -
diff --git a/app/views/admin/ivn_components/index.html.erb b/app/views/admin/ivn_components/index.html.erb deleted file mode 100644 index bb0c4f705..000000000 --- a/app/views/admin/ivn_components/index.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -<% content_for :navigation_title do %> - IVN Components - <%= link_to new_admin_ivn_component_path, class: "usa-button usa-button-inverted float-right" do %> - - New IVN Component - <% end %> -<% end %> - -

- <%= link_to admin_root_path do %> - - Back to Admin - <% end %> -

- -
- - - - - - - - - - <% @ivn_components.each do |ivn_component| %> - - - - - - <% end %> - -
- Name - - URL - - Description -
- <%= link_to(ivn_component.name, admin_ivn_component_path(ivn_component)) %> - - <%= ivn_component.url %> - - <%= ivn_component.description %> -
-
diff --git a/app/views/admin/ivn_components/new.html.erb b/app/views/admin/ivn_components/new.html.erb deleted file mode 100644 index 7eaeb1917..000000000 --- a/app/views/admin/ivn_components/new.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<% content_for :navigation_title do %> - Creating new IVN Component -<% end %> - -

- <%= link_to admin_ivn_components_path do %> - - Back to IVN Components - <% end %> -

- -<%= render "form", ivn_component: @ivn_component %> diff --git a/app/views/admin/ivn_components/show.html.erb b/app/views/admin/ivn_components/show.html.erb deleted file mode 100644 index 35e0b7ffd..000000000 --- a/app/views/admin/ivn_components/show.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -<% content_for :navigation_title do %> - IVN Components - <%= link_to edit_admin_ivn_component_path(@ivn_component), class: "usa-button usa-button-inverted float-right" do %> - - Edit IVN Component - <% end %> -<% end %> - -

- <%= link_to admin_ivn_components_path do %> - - Back to IVN Components - <% end %> -

- -<%= render @ivn_component %> - - - -

- Related components -

- -
- <% @ivn_component.ivn_components.each do |ivn_component| %> - <%= link_to ivn_component.name, admin_ivn_component_path(ivn_component) %> -
- <%= ivn_component.url %> -
- <%= ivn_component.description %> -
- <% end %> -
diff --git a/app/views/admin/ivn_links/_form.html.erb b/app/views/admin/ivn_links/_form.html.erb deleted file mode 100644 index 14d691b79..000000000 --- a/app/views/admin/ivn_links/_form.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= form_with(model: [:admin, ivn_link]) do |form| %> - <%- if ivn_link.errors.any? %> -
-

<%= pluralize(ivn_link.errors.count, "error") %> prohibited this ivn_link from being saved:

- - -
- <% end %> - -
- <%= form.label :from_id, style: "display: block" %> - <%= form.number_field :from_id %> -
- -
- <%= form.label :to_id, style: "display: block" %> - <%= form.number_field :to_id %> -
- -
- <%= form.submit %> -
-<% end %> diff --git a/app/views/admin/ivn_links/_ivn_link.html.erb b/app/views/admin/ivn_links/_ivn_link.html.erb deleted file mode 100644 index 6a8f33873..000000000 --- a/app/views/admin/ivn_links/_ivn_link.html.erb +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/app/views/admin/ivn_links/edit.html.erb b/app/views/admin/ivn_links/edit.html.erb deleted file mode 100644 index c5e24a670..000000000 --- a/app/views/admin/ivn_links/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

Editing ivn link

- -<%= render "form", ivn_link: @ivn_link %> - -
- -
- <%= link_to "Show this ivn link", [:admin, @ivn_link] %> | - <%= link_to "Back to ivn links", admin_ivn_links_path %> -
diff --git a/app/views/admin/ivn_links/index.html.erb b/app/views/admin/ivn_links/index.html.erb deleted file mode 100644 index 79080bc83..000000000 --- a/app/views/admin/ivn_links/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

<%= notice %>

- -

Ivn links

- - - -<%= link_to "New ivn link", new_admin_ivn_link_path %> diff --git a/app/views/admin/ivn_links/new.html.erb b/app/views/admin/ivn_links/new.html.erb deleted file mode 100644 index b536fb163..000000000 --- a/app/views/admin/ivn_links/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

New ivn link

- -<%= render "form", ivn_link: @ivn_link %> - -
- -
- <%= link_to "Back to ivn links", admin_ivn_links_path %> -
diff --git a/app/views/admin/ivn_links/show.html.erb b/app/views/admin/ivn_links/show.html.erb deleted file mode 100644 index 2d589db3d..000000000 --- a/app/views/admin/ivn_links/show.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

<%= notice %>

- -<%= render @ivn_link %> - -
- <%= link_to "Edit this ivn link", edit_admin_ivn_link_path(@ivn_link) %> | - <%= link_to "Back to ivn links", admin_ivn_links_path %> - - <%= button_to "Destroy this ivn link", [:admin, @ivn_link], method: :delete %> -
diff --git a/app/views/admin/ivn_source_component_links/_form.html.erb b/app/views/admin/ivn_source_component_links/_form.html.erb deleted file mode 100644 index 6ced586a1..000000000 --- a/app/views/admin/ivn_source_component_links/_form.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= form_with(model: [:admin, ivn_source_component_link]) do |form| %> - <%- if ivn_source_component_link.errors.any? %> -
-

<%= pluralize(ivn_source_component_link.errors.count, "error") %> prohibited this ivn_source_component_link from being saved:

- - -
- <% end %> - -
- <%= form.label :from_id, style: "display: block" %> - <%= form.number_field :from_id %> -
- -
- <%= form.label :to_id, style: "display: block" %> - <%= form.number_field :to_id %> -
- -
- <%= form.submit %> -
-<% end %> diff --git a/app/views/admin/ivn_source_component_links/_ivn_source_component_link.html.erb b/app/views/admin/ivn_source_component_links/_ivn_source_component_link.html.erb deleted file mode 100644 index 1a8adda9a..000000000 --- a/app/views/admin/ivn_source_component_links/_ivn_source_component_link.html.erb +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/app/views/admin/ivn_source_component_links/edit.html.erb b/app/views/admin/ivn_source_component_links/edit.html.erb deleted file mode 100644 index 6e34b0a71..000000000 --- a/app/views/admin/ivn_source_component_links/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

Editing ivn source component link

- -<%= render "form", ivn_source_component_link: @ivn_source_component_link %> - -
- -
- <%= link_to "Show this ivn source component link", [:admin, @ivn_source_component_link] %> | - <%= link_to "Back to ivn source component links", admin_ivn_source_component_links_path %> -
diff --git a/app/views/admin/ivn_source_component_links/index.html.erb b/app/views/admin/ivn_source_component_links/index.html.erb deleted file mode 100644 index 4f5f0d2da..000000000 --- a/app/views/admin/ivn_source_component_links/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

<%= notice %>

- -

Ivn source component links

- - - -<%= link_to "New ivn source component link", new_admin_ivn_source_component_link_path %> diff --git a/app/views/admin/ivn_source_component_links/new.html.erb b/app/views/admin/ivn_source_component_links/new.html.erb deleted file mode 100644 index 2c2e775ca..000000000 --- a/app/views/admin/ivn_source_component_links/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

New ivn source component link

- -<%= render "form", ivn_source_component_link: @ivn_source_component_link %> - -
- -
- <%= link_to "Back to ivn source component links", admin_ivn_source_component_links_path %> -
diff --git a/app/views/admin/ivn_source_component_links/show.html.erb b/app/views/admin/ivn_source_component_links/show.html.erb deleted file mode 100644 index 6b8e4f271..000000000 --- a/app/views/admin/ivn_source_component_links/show.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

<%= notice %>

- -<%= render @ivn_source_component_link %> - -
- <%= link_to "Edit this ivn source component link", edit_admin_ivn_source_component_link_path(@ivn_source_component_link) %> | - <%= link_to "Back to ivn source component links", admin_ivn_source_component_links_path %> - - <%= button_to "Destroy this ivn source component link", [:admin, @ivn_source_component_link], method: :delete %> -
diff --git a/app/views/admin/ivn_sources/_form.html.erb b/app/views/admin/ivn_sources/_form.html.erb deleted file mode 100644 index 5484c7956..000000000 --- a/app/views/admin/ivn_sources/_form.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<%= form_with(model: [:admin, ivn_source]) do |form| %> - <%- if ivn_source.errors.any? %> -
-

<%= pluralize(ivn_source.errors.count, "error") %> prohibited this ivn_source from being saved:

- - -
- <% end %> - -
- <%= form.label :name, style: "display: block" %> - <%= form.text_field :name %> -
- -
- <%= form.label :description, style: "display: block" %> - <%= form.text_area :description %> -
- -
- <%= form.label :url, style: "display: block" %> - <%= form.text_field :url %> -
- -
- <%= form.submit %> -
-<% end %> diff --git a/app/views/admin/ivn_sources/_ivn_source.html.erb b/app/views/admin/ivn_sources/_ivn_source.html.erb deleted file mode 100644 index 5fae52e2c..000000000 --- a/app/views/admin/ivn_sources/_ivn_source.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -
-

- Name: - <%= ivn_source.name %> -

- -

- Description: - <%= ivn_source.description %> -

- -

- Url: - <%= ivn_source.url %> -

- -
diff --git a/app/views/admin/ivn_sources/edit.html.erb b/app/views/admin/ivn_sources/edit.html.erb deleted file mode 100644 index 1fa15fd3b..000000000 --- a/app/views/admin/ivn_sources/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

Editing ivn source

- -<%= render "form", ivn_source: @ivn_source %> - -
- -
- <%= link_to "Show this ivn source", [:admin, @ivn_source] %> | - <%= link_to "Back to ivn sources", admin_ivn_sources_path %> -
diff --git a/app/views/admin/ivn_sources/index.html.erb b/app/views/admin/ivn_sources/index.html.erb deleted file mode 100644 index fa17ca921..000000000 --- a/app/views/admin/ivn_sources/index.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -<% content_for :navigation_title do %> - IVN Sources - <%= link_to new_admin_ivn_source_path, class: "usa-button usa-button-inverted float-right" do %> - - New IVN Source - <% end %> -<% end %> - -

- <%= link_to admin_root_path do %> - - Back to Admin - <% end %> -

- -
- - - - - - - - - - <% @ivn_sources.each do |ivn_source| %> - - - - - - <% end %> - -
- Name - - URL - - Description -
- <%= link_to(ivn_source.name, admin_ivn_source_path(ivn_source)) %> - - <%= ivn_source.url %> - - <%= ivn_source.description %> -
-
diff --git a/app/views/admin/ivn_sources/new.html.erb b/app/views/admin/ivn_sources/new.html.erb deleted file mode 100644 index b5e583695..000000000 --- a/app/views/admin/ivn_sources/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

New ivn source

- -<%= render "form", ivn_source: @ivn_source %> - -
- -
- <%= link_to "Back to ivn sources", admin_ivn_sources_path %> -
diff --git a/app/views/admin/ivn_sources/show.html.erb b/app/views/admin/ivn_sources/show.html.erb deleted file mode 100644 index 025db1d13..000000000 --- a/app/views/admin/ivn_sources/show.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

<%= notice %>

- -<%= render @ivn_source %> - -
- <%= link_to "Edit this ivn source", edit_admin_ivn_source_path(@ivn_source) %> | - <%= link_to "Back to ivn sources", admin_ivn_sources_path %> - - <%= button_to "Destroy this ivn source", [:admin, @ivn_source], method: :delete %> -
diff --git a/db/migrate/20250214194816_cache_submission_preview.rb b/db/migrate/20250214194816_cache_submission_preview.rb index 77041be5b..99b7bf80c 100644 --- a/db/migrate/20250214194816_cache_submission_preview.rb +++ b/db/migrate/20250214194816_cache_submission_preview.rb @@ -1,11 +1,5 @@ class CacheSubmissionPreview < ActiveRecord::Migration[7.2] def change add_column :submissions, :preview, :string, default: "" - - Submission.unscoped.in_batches(of: 10_000) do |batch| - batch.each do |submission| - submission.set_preview - end - end end end diff --git a/db/migrate/20250221194420_remove_ivn.rb b/db/migrate/20250221194420_remove_ivn.rb new file mode 100644 index 000000000..173ee7f21 --- /dev/null +++ b/db/migrate/20250221194420_remove_ivn.rb @@ -0,0 +1,8 @@ +class RemoveIvn < ActiveRecord::Migration[7.2] + def change + drop_table :ivn_component_links + drop_table :ivn_components + drop_table :ivn_source_component_links + drop_table :ivn_sources + end +end diff --git a/db/schema.rb b/db/schema.rb index e6be70f30..23ff5f477 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2025_02_14_194816) do +ActiveRecord::Schema[7.2].define(version: 2025_02_21_194420) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -321,37 +321,6 @@ t.index ["uuid"], name: "index_forms_on_uuid", unique: true end - create_table "ivn_component_links", force: :cascade do |t| - t.integer "from_id" - t.integer "to_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "ivn_components", force: :cascade do |t| - t.string "name" - t.text "description" - t.string "url" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "ivn_source_component_links", force: :cascade do |t| - t.integer "from_id" - t.integer "to_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "ivn_sources", force: :cascade do |t| - t.string "name" - t.text "description" - t.string "url" - t.integer "organization_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - create_table "omb_cx_reporting_collections", comment: "A detailed record belonging to a Collection; a quarterly CX Data Collection", force: :cascade do |t| t.integer "collection_id" t.string "service_provided" diff --git a/db/seeds.rb b/db/seeds.rb index d65b1d213..ac4ee530a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -704,50 +704,6 @@ def production_suitable_seeds name: 'Example Persona 3' }) - -puts 'Creating IVN Sources, Components, and Links...' -@organizations = Organization.all - -for i in (1..20) do -IvnSource.create!({ - name: "IVN Source Name #{i}", - description: "IVN Source Description #{i}", - url: "https://example.gov/ivn-source-url-#{i}", - organization: @organizations.sample, -}) -end - -for i in (1..50) do -IvnComponent.create!({ - name: "IVN Description Name #{i}", - description: "IVN Description Description #{i}", - url: "https://example.gov/ivn-component-url-#{i}", -}) -end - -@ivn_components = IvnComponent.all -@ivn_sources = IvnSource.all - -for i in (1..100) do - from_id = @ivn_components.sample - to_id = (@ivn_components - [from_id]).sample - - IvnComponentLink.create!({ - from_id: from_id.id, - to_id: to_id.id, - }) -end - -for i in (1..50) do - from_id = @ivn_sources.sample - to_id = @ivn_components.sample - - IvnSourceComponentLink.create!({ - from_id: from_id.id, - to_id: to_id.id, - }) -end - for i in (1..20) do DigitalServiceAccount.create!({ organization_list: [@gsa.id], diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 41e50c7d1..5740d1051 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -6,19 +6,37 @@ describe 'submission_notification' do let!(:organization) { FactoryBot.create(:organization) } let(:user) { FactoryBot.create(:user, organization:) } + let(:inactive_user) { FactoryBot.create(:user, organization:, inactive: true) } let(:form) { FactoryBot.create(:form, :single_question, organization:) } let!(:submission) { FactoryBot.create(:submission, form:) } let(:mail) { UserMailer.submission_notification(submission_id: submission.id, emails: [user.email]) } - it 'renders the headers' do - expect(mail.subject).to eq("New Submission to #{submission.form.name}") - expect(mail.to).to eq([user.email]) - expect(mail.from).to eq([ENV.fetch('TOUCHPOINTS_EMAIL_SENDER')]) + context "with active emails" do + it 'renders the headers' do + expect(mail.subject).to eq("New Submission to #{submission.form.name}") + expect(mail.to).to eq([user.email]) + expect(mail.from).to eq([ENV.fetch('TOUCHPOINTS_EMAIL_SENDER')]) + + expect { + mail.deliver_now + }.to change(ActionMailer::Base.deliveries, :count).by(1) + end + + it 'renders the body' do + expect(mail.body.encoded).to have_text('Touchpoints.gov Response Notification') + expect(mail.body.encoded).to have_text("New feedback has been submitted to your form, #{submission.form.name}.") + end end - it 'renders the body' do - expect(mail.body.encoded).to have_text('Touchpoints.gov Response Notification') - expect(mail.body.encoded).to have_text("New feedback has been submitted to your form, #{submission.form.name}.") + context "with inactive emails" do + let(:inactive_mail) { UserMailer.submission_notification(submission_id: submission.id, emails: [inactive_user.email]) } + + it 'does not send email when recipients are inactive' do + expect(inactive_mail.deliver_now).to eq(nil) + expect { + inactive_mail.deliver_now + }.to_not change(ActionMailer::Base.deliveries, :count) + end end end diff --git a/spec/models/ivn_component_link_spec.rb b/spec/models/ivn_component_link_spec.rb deleted file mode 100644 index f3f7793a2..000000000 --- a/spec/models/ivn_component_link_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe IvnComponentLink, type: :model do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/ivn_component_spec.rb b/spec/models/ivn_component_spec.rb deleted file mode 100644 index f21e3fdbb..000000000 --- a/spec/models/ivn_component_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe IvnComponent, type: :model do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/ivn_source_component_link_spec.rb b/spec/models/ivn_source_component_link_spec.rb deleted file mode 100644 index daab87aa5..000000000 --- a/spec/models/ivn_source_component_link_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe IvnSourceComponentLink, type: :model do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/ivn_source_spec.rb b/spec/models/ivn_source_spec.rb deleted file mode 100644 index 0d25b3914..000000000 --- a/spec/models/ivn_source_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe IvnSource, type: :model do - pending "add some examples to (or delete) #{__FILE__}" -end