Sha256: 7ea6fc57eaf0bc535a29abc90f4c3f57475abe363145950264968bfffe7c38b8
Contents?: true
Size: 1.09 KB
Versions: 16
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true require 'pagy' module Emailbutler class UiController < Emailbutler::ApplicationController include ::Pagy::Backend http_basic_authenticate_with name: ::Emailbutler.configuration.ui_username, password: ::Emailbutler.configuration.ui_password, if: -> { basic_auth_enabled? } def index @summary = ::Emailbutler.count_messages_by_status end def show @pagy, @messages = pagy(::Emailbutler.find_messages_by(search_condition)) end private def search_condition { status: params[:id] == 'all' ? nil : params[:id], mailer: params[:mailer_name].presence, action: params[:action_name].presence, send_to: [params[:receiver].presence].compact.presence }.compact end def basic_auth_enabled? configuration = ::Emailbutler.configuration return false if configuration.ui_username.blank? return false if configuration.ui_password.blank? configuration.ui_secured_environments.include?(Rails.env) end end end
Version data entries
16 entries across 16 versions & 1 rubygems