Sha256: 4148aa9e4b77d8ec22dc5d31cd7938f6c158e4b5921b80f9f79a2719dfd96c85
Contents?: true
Size: 1.08 KB
Versions: 11
Compression:
Stored size: 1.08 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
11 entries across 11 versions & 1 rubygems