diff --git a/app/forms/ask_a_question_form.rb b/app/forms/ask_a_question_form.rb index 0b9c0561d..bafad8d13 100644 --- a/app/forms/ask_a_question_form.rb +++ b/app/forms/ask_a_question_form.rb @@ -1,17 +1,18 @@ # frozen_string_literal: true -class AskAQuestionForm +class AskAQuestionForm < MailForm::Base include ActiveModel::Model attr_accessor :name, :email, :message, :context, :title validates :name, :email, :message, presence: true validates :email, email: true + attribute :feedback_desc, captcha: true def email_subject "[Catalog] #{title}" end def submit - ContactMailer.with(form: self).question.deliver + ContactMailer.with(form: self).question.deliver unless spam? @submitted = true @name = "" @email = "" diff --git a/app/forms/report_harmful_language_form.rb b/app/forms/report_harmful_language_form.rb index 0f2355862..a6019f928 100644 --- a/app/forms/report_harmful_language_form.rb +++ b/app/forms/report_harmful_language_form.rb @@ -1,16 +1,17 @@ # frozen_string_literal: true -class ReportHarmfulLanguageForm +class ReportHarmfulLanguageForm < MailForm::Base include ActiveModel::Model attr_accessor :name, :email, :message, :context, :title validates :message, presence: true + attribute :feedback_desc, captcha: true def email_subject "[Possible Harmful Language] #{title}" end def submit - ContactMailer.with(form: self).harmful_language.deliver + ContactMailer.with(form: self).harmful_language.deliver unless spam? @submitted = true @name = "" @email = "" diff --git a/app/forms/suggest_correction_form.rb b/app/forms/suggest_correction_form.rb index d1154488e..07163ba66 100644 --- a/app/forms/suggest_correction_form.rb +++ b/app/forms/suggest_correction_form.rb @@ -1,18 +1,19 @@ # frozen_string_literal: true -class SuggestCorrectionForm +class SuggestCorrectionForm < MailForm::Base include ActiveModel::Model attr_accessor :name, :email, :message, :context, :title validates :name, :email, :message, :context, presence: true validates :email, email: true + attribute :feedback_desc, captcha: true def email_subject "[Catalog] #{title}" end def submit - ContactMailer.with(form: self).suggestion.deliver + ContactMailer.with(form: self).suggestion.deliver unless spam? @submitted = true @name = "" @email = "" diff --git a/app/views/catalog/_ask_a_question_form.html.erb b/app/views/catalog/_ask_a_question_form.html.erb index 75c5d1105..c3a5d5efb 100644 --- a/app/views/catalog/_ask_a_question_form.html.erb +++ b/app/views/catalog/_ask_a_question_form.html.erb @@ -15,6 +15,7 @@ <%= f.input_field :message, as: :text, style: "width: 100%" %>
<%= f.input :context, as: :hidden %> <%= f.input :title, as: :hidden %> + <%= f.input :feedback_desc, as: :hidden %>