<commit_before>module Refinery
  module Inquiries
    class InquiriesController < ::ApplicationController

      before_filter :find_page, only: [:create, :new]
      before_filter :find_thank_you_page, only: :thank_you

      def thank_you
      end

      def new
        @inquiry = Inquiry.new
      end

      def create
        @inquiry = Inquiry.new(inquiry_params)

        if @inquiry.save
          if @inquiry.ham? || Inquiries.send_notifications_for_inquiries_marked_as_spam
            begin
              InquiryMailer.notification(@inquiry, request).deliver
            rescue
              logger.warn "There was an error delivering an inquiry notification.\n#{$!}\n"
            end

            if Setting.send_confirmation?
              begin
                InquiryMailer.confirmation(@inquiry, request).deliver
              rescue
                logger.warn "There was an error delivering an inquiry confirmation:\n#{$!}\n"
              end
            end
          end

          redirect_to refinery.thank_you_inquiries_inquiries_path
        else
          render :action => 'new'
        end
      end

      protected

      def find_page
        @page = Page.find_by(link_url: Refinery::Inquiries.page_path_new)
      end

      def find_thank_you_page
        @page = Page.find_by(link_url: Refinery::Inquiries.page_path_thank_you)
      end

      private

      def inquiry_params
        params.require(:inquiry).permit(:name, :phone, :message, :email)
      end

    end
  end
end<commit_msg>Add permitted_inquiry_params method<commit_after>module Refinery
  module Inquiries
    class InquiriesController < ::ApplicationController

      before_action :find_page, only: [:create, :new]
      before_action :find_thank_you_page, only: :thank_you

      def thank_you
      end

      def new
        @inquiry = Inquiry.new
      end

      def create
        @inquiry = Inquiry.new(inquiry_params)

        if @inquiry.save
          if @inquiry.ham? || Inquiries.send_notifications_for_inquiries_marked_as_spam
            begin
              InquiryMailer.notification(@inquiry, request).deliver
            rescue
              logger.warn "There was an error delivering an inquiry notification.\n#{$!}\n"
            end

            if Setting.send_confirmation?
              begin
                InquiryMailer.confirmation(@inquiry, request).deliver
              rescue
                logger.warn "There was an error delivering an inquiry confirmation:\n#{$!}\n"
              end
            end
          end

          redirect_to refinery.thank_you_inquiries_inquiries_path
        else
          render action: 'new'
        end
      end

      protected

      def find_page
        @page = Page.find_by(link_url: Refinery::Inquiries.page_path_new)
      end

      def find_thank_you_page
        @page = Page.find_by(link_url: Refinery::Inquiries.page_path_thank_you)
      end

      def inquiry_params
        params.require(:inquiry).permit(permitted_inquiry_params)
      end
      
      private
      
      def permitted_inquiry_params
        [:name, :phone, :message, :email]
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.06818181818181818, 'fraction_numerical': 0.0, 'mean_word_length': 1.9700093720712277, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6437300', 'n_tokens_mistral': 938, 'n_tokens_neox': 883, 'n_words': 199}