From 0d62e841b393248722277f2ef9a6b0ceb827a683 Mon Sep 17 00:00:00 2001 From: Ryan Wold <64987852+ryanwoldatwork@users.noreply.github.com> Date: Mon, 24 Feb 2025 14:38:14 -0800 Subject: [PATCH] remove IVN * remove Submission updates in migration. this will be run manually, once. --- .../admin/ivn_components_controller.rb | 70 ----------------- app/controllers/admin/ivn_links_controller.rb | 70 ----------------- .../ivn_source_component_links_controller.rb | 70 ----------------- .../admin/ivn_sources_controller.rb | 75 ------------------- app/mailers/user_mailer.rb | 2 + app/models/ivn_component.rb | 6 -- app/models/ivn_component_link.rb | 6 -- app/models/ivn_source.rb | 7 -- app/models/ivn_source_component_link.rb | 6 -- app/serializers/admin/ivn_link_serializer.rb | 7 -- .../ivn_source_component_link_serializer.rb | 7 -- app/serializers/ivn_component_serializer.rb | 5 -- app/serializers/ivn_source_serializer.rb | 5 -- app/views/admin/ivn_components/_form.html.erb | 32 -------- .../ivn_components/_ivn_component.html.erb | 17 ----- app/views/admin/ivn_components/edit.html.erb | 11 --- app/views/admin/ivn_components/index.html.erb | 47 ------------ app/views/admin/ivn_components/new.html.erb | 12 --- app/views/admin/ivn_components/show.html.erb | 33 -------- app/views/admin/ivn_links/_form.html.erb | 27 ------- app/views/admin/ivn_links/_ivn_link.html.erb | 12 --- app/views/admin/ivn_links/edit.html.erb | 10 --- app/views/admin/ivn_links/index.html.erb | 14 ---- app/views/admin/ivn_links/new.html.erb | 9 --- app/views/admin/ivn_links/show.html.erb | 10 --- .../ivn_source_component_links/_form.html.erb | 27 ------- .../_ivn_source_component_link.html.erb | 12 --- .../ivn_source_component_links/edit.html.erb | 10 --- .../ivn_source_component_links/index.html.erb | 14 ---- .../ivn_source_component_links/new.html.erb | 9 --- .../ivn_source_component_links/show.html.erb | 10 --- app/views/admin/ivn_sources/_form.html.erb | 32 -------- .../admin/ivn_sources/_ivn_source.html.erb | 17 ----- app/views/admin/ivn_sources/edit.html.erb | 10 --- app/views/admin/ivn_sources/index.html.erb | 47 ------------ app/views/admin/ivn_sources/new.html.erb | 9 --- app/views/admin/ivn_sources/show.html.erb | 10 --- ...20250214194816_cache_submission_preview.rb | 6 -- db/migrate/20250221194420_remove_ivn.rb | 8 ++ db/schema.rb | 33 +------- db/seeds.rb | 44 ----------- spec/mailers/user_mailer_spec.rb | 32 ++++++-- spec/models/ivn_component_link_spec.rb | 5 -- spec/models/ivn_component_spec.rb | 5 -- spec/models/ivn_source_component_link_spec.rb | 5 -- spec/models/ivn_source_spec.rb | 5 -- 46 files changed, 36 insertions(+), 884 deletions(-) delete mode 100644 app/controllers/admin/ivn_components_controller.rb delete mode 100644 app/controllers/admin/ivn_links_controller.rb delete mode 100644 app/controllers/admin/ivn_source_component_links_controller.rb delete mode 100644 app/controllers/admin/ivn_sources_controller.rb delete mode 100644 app/models/ivn_component.rb delete mode 100644 app/models/ivn_component_link.rb delete mode 100644 app/models/ivn_source.rb delete mode 100644 app/models/ivn_source_component_link.rb delete mode 100644 app/serializers/admin/ivn_link_serializer.rb delete mode 100644 app/serializers/admin/ivn_source_component_link_serializer.rb delete mode 100644 app/serializers/ivn_component_serializer.rb delete mode 100644 app/serializers/ivn_source_serializer.rb delete mode 100644 app/views/admin/ivn_components/_form.html.erb delete mode 100644 app/views/admin/ivn_components/_ivn_component.html.erb delete mode 100644 app/views/admin/ivn_components/edit.html.erb delete mode 100644 app/views/admin/ivn_components/index.html.erb delete mode 100644 app/views/admin/ivn_components/new.html.erb delete mode 100644 app/views/admin/ivn_components/show.html.erb delete mode 100644 app/views/admin/ivn_links/_form.html.erb delete mode 100644 app/views/admin/ivn_links/_ivn_link.html.erb delete mode 100644 app/views/admin/ivn_links/edit.html.erb delete mode 100644 app/views/admin/ivn_links/index.html.erb delete mode 100644 app/views/admin/ivn_links/new.html.erb delete mode 100644 app/views/admin/ivn_links/show.html.erb delete mode 100644 app/views/admin/ivn_source_component_links/_form.html.erb delete mode 100644 app/views/admin/ivn_source_component_links/_ivn_source_component_link.html.erb delete mode 100644 app/views/admin/ivn_source_component_links/edit.html.erb delete mode 100644 app/views/admin/ivn_source_component_links/index.html.erb delete mode 100644 app/views/admin/ivn_source_component_links/new.html.erb delete mode 100644 app/views/admin/ivn_source_component_links/show.html.erb delete mode 100644 app/views/admin/ivn_sources/_form.html.erb delete mode 100644 app/views/admin/ivn_sources/_ivn_source.html.erb delete mode 100644 app/views/admin/ivn_sources/edit.html.erb delete mode 100644 app/views/admin/ivn_sources/index.html.erb delete mode 100644 app/views/admin/ivn_sources/new.html.erb delete mode 100644 app/views/admin/ivn_sources/show.html.erb create mode 100644 db/migrate/20250221194420_remove_ivn.rb delete mode 100644 spec/models/ivn_component_link_spec.rb delete mode 100644 spec/models/ivn_component_spec.rb delete mode 100644 spec/models/ivn_source_component_link_spec.rb delete mode 100644 spec/models/ivn_source_spec.rb 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? %> -
- <%= 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 %> -
- -- <%= link_to admin_root_path do %> - - Back to Admin - <% end %> -
- -| - Name - | -- URL - | -- Description - | -
|---|---|---|
| - <%= link_to(ivn_component.name, admin_ivn_component_path(ivn_component)) %> - | -- <%= ivn_component.url %> - | -- <%= ivn_component.description %> - | -
- <%= 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 %> - - - -- From: - <%= ivn_link.from_id %> -
- -- To: - <%= ivn_link.to_id %> -
- -<%= notice %>
- -- <%= link_to "Show this ivn link", [:admin, ivn_link] %> -
- <% end %> -<%= notice %>
- -<%= render @ivn_link %> - -- From: - <%= ivn_source_component_link.from_id %> -
- -- To: - <%= ivn_source_component_link.to_id %> -
- -<%= notice %>
- -- <%= link_to "Show this ivn source component link", [:admin, ivn_source_component_link] %> -
- <% end %> -<%= notice %>
- -<%= render @ivn_source_component_link %> - -- Name: - <%= ivn_source.name %> -
- -- Description: - <%= ivn_source.description %> -
- -- Url: - <%= ivn_source.url %> -
- -- <%= link_to admin_root_path do %> - - Back to Admin - <% end %> -
- -| - Name - | -- URL - | -- Description - | -
|---|---|---|
| - <%= link_to(ivn_source.name, admin_ivn_source_path(ivn_source)) %> - | -- <%= ivn_source.url %> - | -- <%= ivn_source.description %> - | -
<%= notice %>
- -<%= render @ivn_source %> - -