web47core 0.1.11 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +29 -27
- data/{lib/app → app}/helpers/core_helper.rb +25 -9
- data/{lib/app → app}/helpers/core_link_helper.rb +3 -1
- data/app/views/admin/cron/edit.html.haml +1 -0
- data/app/views/admin/cron/index.html.haml +1 -0
- data/app/views/admin/delayed_jobs/index.html.haml +1 -0
- data/app/views/admin/delayed_jobs/show.html.haml +1 -0
- data/app/views/admin/system_configurations/edit.html.haml +1 -0
- data/app/views/admin/system_configurations/show.html.haml +1 -0
- data/app/views/common/_form_actions.html.haml +11 -0
- data/app/views/cron/_edit.html.haml +21 -0
- data/app/views/cron/_index.html.haml +70 -0
- data/app/views/cron/edit.html.haml +1 -0
- data/app/views/cron/index.html.haml +1 -0
- data/app/views/delayed_jobs/_index.html.haml +54 -0
- data/app/views/delayed_jobs/_show.html.haml +58 -0
- data/app/views/delayed_jobs/index.html.haml +1 -0
- data/app/views/delayed_jobs/show.html.haml +1 -0
- data/app/views/stack/cron/edit.html.haml +1 -0
- data/app/views/stack/cron/index.html.haml +1 -0
- data/app/views/stack/system_configurations/edit.html.haml +5 -0
- data/app/views/stack/system_configurations/show.html.haml +3 -0
- data/{lib/app/views/system_configurations/edit.html.haml → app/views/system_configurations/_edit.html.haml} +2 -10
- data/{lib/app/views/system_configurations/show.html.haml → app/views/system_configurations/_show.html.haml} +3 -3
- data/app/views/system_configurations/edit.html.haml +1 -0
- data/app/views/system_configurations/show.html.haml +1 -0
- data/config/locales/en.yml +75 -2
- data/config/routes.rb +1 -1
- data/lib/app/controllers/concerns/core_controller.rb +22 -0
- data/lib/app/controllers/concerns/core_cron_controller.rb +79 -0
- data/lib/app/controllers/concerns/core_delayed_jobs_controller.rb +87 -0
- data/lib/app/controllers/concerns/core_system_configuration_controller.rb +3 -3
- data/lib/app/jobs/cron/command.rb +5 -2
- data/lib/app/jobs/cron/job_tab.rb +4 -6
- data/lib/app/jobs/cron/server.rb +6 -3
- data/lib/app/jobs/cron/switchboard_sync_models.rb +1 -1
- data/lib/app/jobs/cron/tab.rb +3 -3
- data/lib/app/models/concerns/core_account.rb +1 -10
- data/lib/app/models/concerns/core_system_configuration.rb +13 -13
- data/lib/app/models/delayed_job.rb +1 -1
- data/lib/app/models/email_notification.rb +6 -6
- data/lib/app/models/email_template.rb +4 -1
- data/lib/app/models/notification.rb +12 -11
- data/lib/app/models/redis_configuration.rb +1 -1
- data/lib/app/models/template.rb +1 -1
- data/lib/templates/slack/error_message.liquid +3 -1
- data/lib/web47core/config.rb +4 -6
- data/lib/web47core/engine.rb +1 -1
- data/lib/web47core/version.rb +1 -1
- data/lib/web47core.rb +4 -5
- metadata +50 -12
- /data/{lib/app → app}/helpers/core_form_helper.rb +0 -0
| @@ -0,0 +1,79 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Manage cron job servers
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            module CoreCronController
         | 
| 7 | 
            +
              include CoreController
         | 
| 8 | 
            +
              #
         | 
| 9 | 
            +
              # Table to display cron job servers
         | 
| 10 | 
            +
              #
         | 
| 11 | 
            +
              def index
         | 
| 12 | 
            +
                authorize! :read, Cron::Server
         | 
| 13 | 
            +
                authorize! :read, Cron::Tab
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              #
         | 
| 17 | 
            +
              # Run the crontab entry now
         | 
| 18 | 
            +
              #
         | 
| 19 | 
            +
              def run_now
         | 
| 20 | 
            +
                authorize! :read, cron_tab
         | 
| 21 | 
            +
                cron_tab.run
         | 
| 22 | 
            +
                redirect_to index_path
         | 
| 23 | 
            +
              rescue StandardError => error
         | 
| 24 | 
            +
                log_controller_error error, true
         | 
| 25 | 
            +
                redirect_to index_path
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              #
         | 
| 29 | 
            +
              # Update a crontab entry
         | 
| 30 | 
            +
              #
         | 
| 31 | 
            +
              def update
         | 
| 32 | 
            +
                authorize! :update, cron_tab
         | 
| 33 | 
            +
                cron_tab.update! cron_tab_params
         | 
| 34 | 
            +
                redirect_to index_path
         | 
| 35 | 
            +
              rescue StandardError => error
         | 
| 36 | 
            +
                log_controller_error error
         | 
| 37 | 
            +
                render :edit
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              #
         | 
| 41 | 
            +
              # Demote a cron job server
         | 
| 42 | 
            +
              #
         | 
| 43 | 
            +
              def demote
         | 
| 44 | 
            +
                authorize! :edit, cron_server
         | 
| 45 | 
            +
                cron_server.become_secondary
         | 
| 46 | 
            +
                redirect_to index_path
         | 
| 47 | 
            +
              rescue StandardError => error
         | 
| 48 | 
            +
                log_controller_error error, true
         | 
| 49 | 
            +
                redirect_to index_path
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
              #
         | 
| 53 | 
            +
              # Destroy a cron job server
         | 
| 54 | 
            +
              #
         | 
| 55 | 
            +
              def destroy
         | 
| 56 | 
            +
                authorize! :destroy, cron_server
         | 
| 57 | 
            +
                cron_server.destroy!
         | 
| 58 | 
            +
                redirect_to index_path
         | 
| 59 | 
            +
              rescue StandardError => error
         | 
| 60 | 
            +
                log_controller_error error, true
         | 
| 61 | 
            +
                redirect_to index_path
         | 
| 62 | 
            +
              end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
              private
         | 
| 65 | 
            +
             | 
| 66 | 
            +
              def cron_tab
         | 
| 67 | 
            +
                @cron_tab ||= Cron::Tab.find(params[:id])
         | 
| 68 | 
            +
              end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
              def cron_server
         | 
| 71 | 
            +
                @cron_server ||= Cron::Server.find(params[:id])
         | 
| 72 | 
            +
              end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
              def cron_tab_params
         | 
| 75 | 
            +
                p = params['cron/job_tab']
         | 
| 76 | 
            +
                p[:enabled] ||= false
         | 
| 77 | 
            +
                p.permit(Cron::Tab.allowed_param_names)
         | 
| 78 | 
            +
              end
         | 
| 79 | 
            +
            end
         | 
| @@ -0,0 +1,87 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Manage access to delayed jobs
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            module CoreDelayedJobsController
         | 
| 7 | 
            +
              include CoreController
         | 
| 8 | 
            +
              #
         | 
| 9 | 
            +
              # Show a list of jobs currently in the system
         | 
| 10 | 
            +
              #
         | 
| 11 | 
            +
              def index
         | 
| 12 | 
            +
                authorize! :read, Delayed::Backend::Mongoid::Job
         | 
| 13 | 
            +
                @delayed_jobs = Delayed::Backend::Mongoid::Job.asc(%i[priority run_at]).limit(100)
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              def show
         | 
| 17 | 
            +
                delayed_job
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              #
         | 
| 21 | 
            +
              # Destroy all jobs
         | 
| 22 | 
            +
              #
         | 
| 23 | 
            +
              def destroy_all
         | 
| 24 | 
            +
                authorize! :manage, Delayed::Backend::Mongoid::Job
         | 
| 25 | 
            +
                failed_only = params[:failed_only].eql?('true')
         | 
| 26 | 
            +
                Delayed::Backend::Mongoid::Job.each do |job|
         | 
| 27 | 
            +
                  next if failed_only && !job.failed?
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  job.destroy
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
                flash.now[:info] = 'All DelayJobs has been destroyed'
         | 
| 32 | 
            +
                redirect_to index_path
         | 
| 33 | 
            +
              rescue StandardError => error
         | 
| 34 | 
            +
                log_controller_error error, true
         | 
| 35 | 
            +
                redirect_to index_path
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              #
         | 
| 39 | 
            +
              # Resubmit all jobs that have failed
         | 
| 40 | 
            +
              #
         | 
| 41 | 
            +
              def resubmit_all
         | 
| 42 | 
            +
                authorize! :read, Delayed::Backend::Mongoid::Job
         | 
| 43 | 
            +
                failed_only = params[:failed_only].eql?('true')
         | 
| 44 | 
            +
                Delayed::Backend::Mongoid::Job.each do |job|
         | 
| 45 | 
            +
                  next if failed_only && !job.failed?
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                  job.resubmit
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
                flash.now[:info] = 'All DelayJobs has been resubmitted'
         | 
| 50 | 
            +
                redirect_to index_path
         | 
| 51 | 
            +
              rescue StandardError => error
         | 
| 52 | 
            +
                log_controller_error error, true
         | 
| 53 | 
            +
                redirect_to index_path
         | 
| 54 | 
            +
              end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
              #
         | 
| 57 | 
            +
              # Resubmit the delayed job via update method
         | 
| 58 | 
            +
              #
         | 
| 59 | 
            +
              def resubmit
         | 
| 60 | 
            +
                authorize! :read, delayed_job
         | 
| 61 | 
            +
                delayed_job.resubmit
         | 
| 62 | 
            +
                flash.now[:info] = 'DelayJob has been resubmitted'
         | 
| 63 | 
            +
                redirect_to index_path
         | 
| 64 | 
            +
              rescue StandardError => error
         | 
| 65 | 
            +
                log_controller_error error, true
         | 
| 66 | 
            +
                redirect_to index_path
         | 
| 67 | 
            +
              end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
              #
         | 
| 70 | 
            +
              # Destroy the selected delayed job
         | 
| 71 | 
            +
              #
         | 
| 72 | 
            +
              def destroy
         | 
| 73 | 
            +
                authorize! :manage, delayed_job
         | 
| 74 | 
            +
                delayed_job.destroy!
         | 
| 75 | 
            +
                flash.now[:info] = 'DelayJob has been destroyed'
         | 
| 76 | 
            +
                redirect_to index_path
         | 
| 77 | 
            +
              rescue StandardError => error
         | 
| 78 | 
            +
                log_controller_error error, true
         | 
| 79 | 
            +
                redirect_to index_path
         | 
| 80 | 
            +
              end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
              private
         | 
| 83 | 
            +
             | 
| 84 | 
            +
              def delayed_job
         | 
| 85 | 
            +
                @delayed_job ||= Delayed::Backend::Mongoid::Job.find(params[:id])
         | 
| 86 | 
            +
              end
         | 
| 87 | 
            +
            end
         | 
| @@ -4,7 +4,7 @@ | |
| 4 4 | 
             
            # Manage the system configuration page
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            module CoreSystemConfigurationsController
         | 
| 7 | 
            -
               | 
| 7 | 
            +
              include CoreController
         | 
| 8 8 |  | 
| 9 9 | 
             
              #
         | 
| 10 10 | 
             
              # Edit the system configuration
         | 
| @@ -21,7 +21,7 @@ module CoreSystemConfigurationsController | |
| 21 21 | 
             
                SystemConfiguration.configuration.update! system_configuration_params
         | 
| 22 22 | 
             
                flash[:info] = 'System Configuration Updated, sync job running in the background'
         | 
| 23 23 | 
             
                Cron::SwitchboardSyncConfiguration.perform_later
         | 
| 24 | 
            -
                redirect_to  | 
| 24 | 
            +
                redirect_to index_path
         | 
| 25 25 | 
             
              rescue StandardError => error
         | 
| 26 26 | 
             
                log_controller_error error
         | 
| 27 27 | 
             
                load_configuration
         | 
| @@ -34,7 +34,7 @@ module CoreSystemConfigurationsController | |
| 34 34 | 
             
              # Get the system configuration properties from the request
         | 
| 35 35 | 
             
              #
         | 
| 36 36 | 
             
              def system_configuration_params
         | 
| 37 | 
            -
                params | 
| 37 | 
            +
                params[:system_configuration].permit(%i[switchboard_base_url switchboard_stack_id switchboard_stack_api_token])
         | 
| 38 38 | 
             
              end
         | 
| 39 39 |  | 
| 40 40 | 
             
              #
         | 
| @@ -10,6 +10,9 @@ require 'optparse' | |
| 10 10 | 
             
            require 'pathname'
         | 
| 11 11 |  | 
| 12 12 | 
             
            module Cron
         | 
| 13 | 
            +
              #
         | 
| 14 | 
            +
              # Provide a friendly command structure for managing the cron server
         | 
| 15 | 
            +
              #
         | 
| 13 16 | 
             
              class Command
         | 
| 14 17 |  | 
| 15 18 | 
             
                DIR_PWD = Pathname.new Dir.pwd
         | 
| @@ -21,11 +24,11 @@ module Cron | |
| 21 24 | 
             
                    opt.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options] start|stop|restart|run"
         | 
| 22 25 |  | 
| 23 26 | 
             
                    opt.on('-h', '--help', 'Show this message') do
         | 
| 24 | 
            -
                       | 
| 27 | 
            +
                      warn opt
         | 
| 25 28 | 
             
                      exit 1
         | 
| 26 29 | 
             
                    end
         | 
| 27 30 | 
             
                    opt.on('-e', '--environment=NAME', 'Specifies the environment to run this delayed jobs under (test/development/production).') do |_e|
         | 
| 28 | 
            -
                       | 
| 31 | 
            +
                      warn 'The -e/--environment option has been deprecated and has no effect. Use RAILS_ENV and see http://github.com/collectiveidea/delayed_job/issues/7'
         | 
| 29 32 | 
             
                    end
         | 
| 30 33 | 
             
                    opt.on('--pid-dir=DIR', 'Specifies an alternate directory in which to store the process ids.') do |dir|
         | 
| 31 34 | 
             
                      @options[:pid_dir] = dir
         | 
| @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            #
         | 
| 4 | 
            -
            # Value object for a cron tab entry
         | 
| 5 | 
            -
            #
         | 
| 6 3 | 
             
            module Cron
         | 
| 4 | 
            +
              #
         | 
| 5 | 
            +
              # Value object for a cron tab entry
         | 
| 6 | 
            +
              #
         | 
| 7 7 | 
             
              class JobTab < Tab
         | 
| 8 8 | 
             
                FRAMEWORK_CLASSES = %w[Job TrimCollection Command Server Tab JobTab].freeze unless defined? FRAMEWORK_CLASSES
         | 
| 9 9 | 
             
                #
         | 
| @@ -38,9 +38,7 @@ module Cron | |
| 38 38 | 
             
                  def job_names
         | 
| 39 39 | 
             
                    @job_names ||= Cron.constants.collect do |job|
         | 
| 40 40 | 
             
                      job_name = job.to_s
         | 
| 41 | 
            -
                      next if FRAMEWORK_CLASSES.include?(job_name) ||
         | 
| 42 | 
            -
                        job_name.end_with?('Test') ||
         | 
| 43 | 
            -
                        job_name.start_with?('Base')
         | 
| 41 | 
            +
                      next if FRAMEWORK_CLASSES.include?(job_name) || job_name.end_with?('Test') || job_name.start_with?('Base')
         | 
| 44 42 |  | 
| 45 43 | 
             
                      job_name.underscore
         | 
| 46 44 | 
             
                    end.compact
         | 
    
        data/lib/app/jobs/cron/server.rb
    CHANGED
    
    | @@ -1,7 +1,9 @@ | |
| 1 | 
            -
            #
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            #
         | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 4 3 | 
             
            module Cron
         | 
| 4 | 
            +
              #
         | 
| 5 | 
            +
              # Handle the coordination of which server should be running the cron jobs
         | 
| 6 | 
            +
              #
         | 
| 5 7 | 
             
              class Server
         | 
| 6 8 | 
             
                include StandardModel
         | 
| 7 9 | 
             
                #
         | 
| @@ -108,6 +110,7 @@ module Cron | |
| 108 110 |  | 
| 109 111 | 
             
                #
         | 
| 110 112 | 
             
                # Become secondary node
         | 
| 113 | 
            +
                # TODO: [CMS] Update when auditing in place
         | 
| 111 114 | 
             
                #
         | 
| 112 115 | 
             
                def become_secondary(user = nil)
         | 
| 113 116 | 
             
                  if user.present?
         | 
    
        data/lib/app/jobs/cron/tab.rb
    CHANGED
    
    
| @@ -1,16 +1,7 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            #
         | 
| 4 | 
            -
            # The  | 
| 5 | 
            -
            #
         | 
| 6 | 
            -
            # Use of this class allows you to simply ask for the configuration parameter directly without
         | 
| 7 | 
            -
            # first having to get an instance of it.
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            # SystemConfiguration.queue_impl #=> 'RedisQueue'
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # This method only is allowed for accessors, you should NEVER set values on the SystemConfiguration
         | 
| 12 | 
            -
            # unless you are updating via the Admin or Stack UI, or during testing to setup a specific configuration
         | 
| 13 | 
            -
            # for that.
         | 
| 4 | 
            +
            # The Base Account
         | 
| 14 5 | 
             
            #
         | 
| 15 6 | 
             
            module CoreAccount
         | 
| 16 7 | 
             
              extend ActiveSupport::Concern
         | 
| @@ -1,18 +1,18 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            #
         | 
| 4 | 
            -
            # The System configuration. Various configuration items that can be updated/defined at run time
         | 
| 5 | 
            -
            #
         | 
| 6 | 
            -
            # Use of this class allows you to simply ask for the configuration parameter directly without
         | 
| 7 | 
            -
            # first having to get an instance of it.
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            # SystemConfiguration.queue_impl #=> 'RedisQueue'
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
            # This method only is allowed for accessors, you should NEVER set values on the SystemConfiguration
         | 
| 12 | 
            -
            # unless you are updating via the Admin or Stack UI, or during testing to setup a specific configuration
         | 
| 13 | 
            -
            # for that.
         | 
| 14 | 
            -
            #
         | 
| 15 3 | 
             
            module CoreSystemConfiguration
         | 
| 4 | 
            +
              #
         | 
| 5 | 
            +
              # The System configuration. Various configuration items that can be updated/defined at run time
         | 
| 6 | 
            +
              #
         | 
| 7 | 
            +
              # Use of this class allows you to simply ask for the configuration parameter directly without
         | 
| 8 | 
            +
              # first having to get an instance of it.
         | 
| 9 | 
            +
              #
         | 
| 10 | 
            +
              # SystemConfiguration.queue_impl #=> 'RedisQueue'
         | 
| 11 | 
            +
              #
         | 
| 12 | 
            +
              # This method only is allowed for accessors, you should NEVER set values on the SystemConfiguration
         | 
| 13 | 
            +
              # unless you are updating via the Admin or Stack UI, or during testing to setup a specific configuration
         | 
| 14 | 
            +
              # for that.
         | 
| 15 | 
            +
              #
         | 
| 16 16 | 
             
              extend ActiveSupport::Concern
         | 
| 17 17 |  | 
| 18 18 | 
             
              def self.included(base)
         | 
| @@ -110,7 +110,7 @@ module CoreSystemConfiguration | |
| 110 110 | 
             
                # NOTE: Currently ignored Codacy issue: When using 'method_missing', fall back on 'super'
         | 
| 111 111 | 
             
                #
         | 
| 112 112 | 
             
                # rubocop:disable Style/MethodMissingSuper
         | 
| 113 | 
            -
                def method_missing(method, *args, & | 
| 113 | 
            +
                def method_missing(method, *args, &_block)
         | 
| 114 114 | 
             
                  configuration.send method, *args
         | 
| 115 115 | 
             
                end
         | 
| 116 116 |  | 
| @@ -192,9 +192,9 @@ class EmailNotification < Notification | |
| 192 192 | 
             
                  authentication: smtp.authentication_method.to_sym,
         | 
| 193 193 | 
             
                  enable_starttls_auto: smtp.ssl.eql?(true)
         | 
| 194 194 | 
             
                }
         | 
| 195 | 
            -
                config[:domain] = smtp.domain  | 
| 196 | 
            -
                config[:user_name] = smtp.username  | 
| 197 | 
            -
                config[:password] = smtp.password  | 
| 195 | 
            +
                config[:domain] = smtp.domain if smtp.domain.present?
         | 
| 196 | 
            +
                config[:user_name] = smtp.username if smtp.username.present?
         | 
| 197 | 
            +
                config[:password] = smtp.password if smtp.password.present?
         | 
| 198 198 | 
             
                config
         | 
| 199 199 | 
             
              end
         | 
| 200 200 |  | 
| @@ -231,8 +231,8 @@ class EmailNotification < Notification | |
| 231 231 |  | 
| 232 232 | 
             
              def subject_from_template(template_name, locals)
         | 
| 233 233 | 
             
                subject = account_subject_template(template_name) ||
         | 
| 234 | 
            -
             | 
| 235 | 
            -
             | 
| 234 | 
            +
                          default_subject_template(template_name) ||
         | 
| 235 | 
            +
                          template_from_file(template_name, prefix: 'subject')
         | 
| 236 236 | 
             
                return subject_from_liquid_text(subject, locals) if subject.present?
         | 
| 237 237 |  | 
| 238 238 | 
             
                subject = template_from_file(template_name, format: 'haml', prefix: 'subject')
         | 
| @@ -240,7 +240,7 @@ class EmailNotification < Notification | |
| 240 240 | 
             
              end
         | 
| 241 241 |  | 
| 242 242 | 
             
              def account_subject_template(template_name)
         | 
| 243 | 
            -
                 | 
| 243 | 
            +
                account.templates.emails.find_by(name: template_name.to_s).subject
         | 
| 244 244 | 
             
              rescue StandardError
         | 
| 245 245 | 
             
                nil
         | 
| 246 246 | 
             
              end
         | 
| @@ -1,20 +1,21 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            #
         | 
| 4 | 
            +
            # Base class for notification
         | 
| 4 5 | 
             
            #
         | 
| 5 6 | 
             
            class Notification
         | 
| 6 7 | 
             
              include StandardModel
         | 
| 7 8 | 
             
              #
         | 
| 8 9 | 
             
              # Constants
         | 
| 9 10 | 
             
              #
         | 
| 10 | 
            -
              STATE_INVALID = 'invalid' | 
| 11 | 
            -
              STATE_NEW = 'new' | 
| 12 | 
            -
              STATE_PROCESSED = 'processed' | 
| 13 | 
            -
              STATE_PROCESSING = 'processing' | 
| 14 | 
            -
              STATE_RESUBMITTED = 'resubmitted' | 
| 15 | 
            -
              STATE_RETRYING = 'retrying' | 
| 16 | 
            -
              STATE_SUBMITTED = 'submitted' | 
| 17 | 
            -
              STATE_VIEWED = 'viewed' | 
| 11 | 
            +
              STATE_INVALID = 'invalid' unless defined? STATE_INVALID
         | 
| 12 | 
            +
              STATE_NEW = 'new' unless defined? STATE_NEW
         | 
| 13 | 
            +
              STATE_PROCESSED = 'processed' unless defined? STATE_PROCESSED
         | 
| 14 | 
            +
              STATE_PROCESSING = 'processing' unless defined? STATE_PROCESSING
         | 
| 15 | 
            +
              STATE_RESUBMITTED = 'resubmitted' unless defined? STATE_RESUBMITTED
         | 
| 16 | 
            +
              STATE_RETRYING = 'retrying' unless defined? STATE_RETRYING
         | 
| 17 | 
            +
              STATE_SUBMITTED = 'submitted' unless defined? STATE_SUBMITTED
         | 
| 18 | 
            +
              STATE_VIEWED = 'viewed' unless defined? STATE_VIEWED
         | 
| 18 19 | 
             
              unless defined? ALL_STATES
         | 
| 19 20 | 
             
                ALL_STATES = [STATE_INVALID,
         | 
| 20 21 | 
             
                              STATE_NEW,
         | 
| @@ -28,9 +29,9 @@ class Notification | |
| 28 29 | 
             
              #
         | 
| 29 30 | 
             
              # Channels
         | 
| 30 31 | 
             
              #
         | 
| 31 | 
            -
              DELIVERY_EMAIL = 'email' | 
| 32 | 
            -
              DELIVERY_SLACK = 'slack' | 
| 33 | 
            -
              DELIVERY_SMS = 'sms' | 
| 32 | 
            +
              DELIVERY_EMAIL = 'email' unless defined? DELIVERY_EMAIL
         | 
| 33 | 
            +
              DELIVERY_SLACK = 'slack' unless defined? DELIVERY_SLACK
         | 
| 34 | 
            +
              DELIVERY_SMS = 'sms' unless defined? DELIVERY_SMS
         | 
| 34 35 | 
             
              #
         | 
| 35 36 | 
             
              # Fields
         | 
| 36 37 | 
             
              #
         | 
| @@ -130,7 +130,7 @@ class RedisConfiguration | |
| 130 130 |  | 
| 131 131 | 
             
                  config
         | 
| 132 132 | 
             
                rescue StandardError => error
         | 
| 133 | 
            -
                   | 
| 133 | 
            +
                  App47Logger.log_warn "Error loading #{config_file_path} file", error
         | 
| 134 134 | 
             
                  nil # return nothing if there is an error
         | 
| 135 135 | 
             
                end
         | 
| 136 136 | 
             
              end
         | 
    
        data/lib/app/models/template.rb
    CHANGED
    
    
    
        data/lib/web47core/config.rb
    CHANGED
    
    | @@ -1,14 +1,12 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            #
         | 
| 4 | 
            -
            # Configuration for the Web47Core platform
         | 
| 5 | 
            -
            #
         | 
| 6 3 | 
             
            module Web47core
         | 
| 4 | 
            +
              #
         | 
| 5 | 
            +
              # Configuration for the Web47Core platform
         | 
| 6 | 
            +
              #
         | 
| 7 7 | 
             
              class Config
         | 
| 8 8 | 
             
                include Singleton
         | 
| 9 | 
            -
                attr_accessor :email_able_models,
         | 
| 10 | 
            -
                              :switchboard_able_models,
         | 
| 11 | 
            -
                              :system_configuration_namespace
         | 
| 9 | 
            +
                attr_accessor :email_able_models, :switchboard_able_models
         | 
| 12 10 |  | 
| 13 11 | 
             
                def initialize
         | 
| 14 12 | 
             
                  @email_able_models = []
         | 
    
        data/lib/web47core/engine.rb
    CHANGED
    
    
    
        data/lib/web47core/version.rb
    CHANGED
    
    
    
        data/lib/web47core.rb
    CHANGED
    
    | @@ -1,5 +1,3 @@ | |
| 1 | 
            -
            VERSION = '0.1.6'
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            require 'app/models/concerns/app47_logger'
         | 
| 4 2 | 
             
            require 'app/models/concerns/cdn_url'
         | 
| 5 3 | 
             
            require 'app/models/concerns/email_able'
         | 
| @@ -38,7 +36,8 @@ require 'app/jobs/cron/trim_failed_delayed_jobs' | |
| 38 36 | 
             
            # Controllers
         | 
| 39 37 | 
             
            #
         | 
| 40 38 | 
             
            require 'web47core/engine'
         | 
| 41 | 
            -
            require 'app/controllers/concerns/core_system_configuration_controller'
         | 
| 42 39 | 
             
            require 'app/controllers/concerns/restful_controller'
         | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 40 | 
            +
            require 'app/controllers/concerns/core_controller'
         | 
| 41 | 
            +
            require 'app/controllers/concerns/core_system_configuration_controller'
         | 
| 42 | 
            +
            require 'app/controllers/concerns/core_cron_controller'
         | 
| 43 | 
            +
            require 'app/controllers/concerns/core_delayed_jobs_controller'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: web47core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Chris Schroeder
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020-03- | 
| 11 | 
            +
            date: 2020-03-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -39,19 +39,19 @@ dependencies: | |
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: '0'
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name:  | 
| 42 | 
            +
              name: cancancan
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 | 
            -
                - - " | 
| 45 | 
            +
                - - ">="
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: ' | 
| 47 | 
            +
                    version: '0'
         | 
| 48 48 | 
             
              type: :runtime
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 | 
            -
                - - " | 
| 52 | 
            +
                - - ">="
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: ' | 
| 54 | 
            +
                    version: '0'
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: daemons
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -66,6 +66,20 @@ dependencies: | |
| 66 66 | 
             
                - - ">="
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 68 | 
             
                    version: '0'
         | 
| 69 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            +
              name: delayed_job_mongoid
         | 
| 71 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
                requirements:
         | 
| 73 | 
            +
                - - "~>"
         | 
| 74 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            +
                    version: '2.3'
         | 
| 76 | 
            +
              type: :runtime
         | 
| 77 | 
            +
              prerelease: false
         | 
| 78 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            +
                requirements:
         | 
| 80 | 
            +
                - - "~>"
         | 
| 81 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            +
                    version: '2.3'
         | 
| 69 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 84 | 
             
              name: email_format
         | 
| 71 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -545,16 +559,42 @@ files: | |
| 545 559 | 
             
            - app/controllers/exceptions_controller.rb
         | 
| 546 560 | 
             
            - app/controllers/notifications_controller.rb
         | 
| 547 561 | 
             
            - app/controllers/status_controller.rb
         | 
| 562 | 
            +
            - app/helpers/core_form_helper.rb
         | 
| 563 | 
            +
            - app/helpers/core_helper.rb
         | 
| 564 | 
            +
            - app/helpers/core_link_helper.rb
         | 
| 565 | 
            +
            - app/views/admin/cron/edit.html.haml
         | 
| 566 | 
            +
            - app/views/admin/cron/index.html.haml
         | 
| 567 | 
            +
            - app/views/admin/delayed_jobs/index.html.haml
         | 
| 568 | 
            +
            - app/views/admin/delayed_jobs/show.html.haml
         | 
| 569 | 
            +
            - app/views/admin/system_configurations/edit.html.haml
         | 
| 570 | 
            +
            - app/views/admin/system_configurations/show.html.haml
         | 
| 571 | 
            +
            - app/views/common/_form_actions.html.haml
         | 
| 572 | 
            +
            - app/views/cron/_edit.html.haml
         | 
| 573 | 
            +
            - app/views/cron/_index.html.haml
         | 
| 574 | 
            +
            - app/views/cron/edit.html.haml
         | 
| 575 | 
            +
            - app/views/cron/index.html.haml
         | 
| 576 | 
            +
            - app/views/delayed_jobs/_index.html.haml
         | 
| 577 | 
            +
            - app/views/delayed_jobs/_show.html.haml
         | 
| 578 | 
            +
            - app/views/delayed_jobs/index.html.haml
         | 
| 579 | 
            +
            - app/views/delayed_jobs/show.html.haml
         | 
| 580 | 
            +
            - app/views/stack/cron/edit.html.haml
         | 
| 581 | 
            +
            - app/views/stack/cron/index.html.haml
         | 
| 582 | 
            +
            - app/views/stack/system_configurations/edit.html.haml
         | 
| 583 | 
            +
            - app/views/stack/system_configurations/show.html.haml
         | 
| 548 584 | 
             
            - app/views/status/index.html.haml
         | 
| 585 | 
            +
            - app/views/system_configurations/_edit.html.haml
         | 
| 586 | 
            +
            - app/views/system_configurations/_show.html.haml
         | 
| 587 | 
            +
            - app/views/system_configurations/edit.html.haml
         | 
| 588 | 
            +
            - app/views/system_configurations/show.html.haml
         | 
| 549 589 | 
             
            - bin/cron_server
         | 
| 550 590 | 
             
            - bin/delayed_job
         | 
| 551 591 | 
             
            - config/locales/en.yml
         | 
| 552 592 | 
             
            - config/routes.rb
         | 
| 593 | 
            +
            - lib/app/controllers/concerns/core_controller.rb
         | 
| 594 | 
            +
            - lib/app/controllers/concerns/core_cron_controller.rb
         | 
| 595 | 
            +
            - lib/app/controllers/concerns/core_delayed_jobs_controller.rb
         | 
| 553 596 | 
             
            - lib/app/controllers/concerns/core_system_configuration_controller.rb
         | 
| 554 597 | 
             
            - lib/app/controllers/concerns/restful_controller.rb
         | 
| 555 | 
            -
            - lib/app/helpers/core_form_helper.rb
         | 
| 556 | 
            -
            - lib/app/helpers/core_helper.rb
         | 
| 557 | 
            -
            - lib/app/helpers/core_link_helper.rb
         | 
| 558 598 | 
             
            - lib/app/jobs/application_job.rb
         | 
| 559 599 | 
             
            - lib/app/jobs/cron/command.rb
         | 
| 560 600 | 
             
            - lib/app/jobs/cron/job.rb
         | 
| @@ -586,8 +626,6 @@ files: | |
| 586 626 | 
             
            - lib/app/models/sms_notification.rb
         | 
| 587 627 | 
             
            - lib/app/models/smtp_configuration.rb
         | 
| 588 628 | 
             
            - lib/app/models/template.rb
         | 
| 589 | 
            -
            - lib/app/views/system_configurations/edit.html.haml
         | 
| 590 | 
            -
            - lib/app/views/system_configurations/show.html.haml
         | 
| 591 629 | 
             
            - lib/templates/email/notification_failure.liquid
         | 
| 592 630 | 
             
            - lib/templates/email/notification_failure.subject.liquid
         | 
| 593 631 | 
             
            - lib/templates/slack/error_message.liquid
         | 
| 
            File without changes
         |