Skip to content

Commit

Permalink
Merge pull request #154 from sinfin/foton_updates4
Browse files Browse the repository at this point in the history
Small improvements
  • Loading branch information
mreq authored Dec 19, 2022
2 parents e05edea + b2393e6 commit a0d03d9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/controllers/folio/users/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Folio::Users::RegistrationsController < Devise::RegistrationsController
include Folio::Users::DeviseControllerBase

def new
fail ActionController::MethodNotAllowed, ""
fail ActionController::MethodNotAllowed, "Registrations are created by inviting user, not directly"
end

def edit
Expand All @@ -20,7 +20,7 @@ def edit
end

def create
fail ActionController::MethodNotAllowed, ""
fail ActionController::MethodNotAllowed, "Registrations are created by inviting user, not directly"

build_resource(sign_up_params)

Expand Down
2 changes: 2 additions & 0 deletions app/models/concerns/folio/belongs_to_site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ module Folio::BelongsToSite
validate :validate_belongs_to_site

scope :by_atom_setting_site_id, -> (site_id) { where(site_id:) }
scope :by_site, ->(site) { where(site:) }
scope :by_site_id, ->(site_id) { where(site_id:) }
end

class_methods do
Expand Down
7 changes: 7 additions & 0 deletions app/models/folio/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ def layout_twitter_meta
}
end

def <=>(other)
res = self.title <=> other.title
return res unless res.zero?

self.id <=> other.id
end

def console_form_tabs_base
%i[
header_message
Expand Down
7 changes: 7 additions & 0 deletions app/models/folio/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ def to_console_label
end
end

def <=>(other)
res = self.full_name <=> other.full_name
return res unless res.zero?

self.id <=> other.id
end

def remember_me
super.nil? ? "1" : super
end
Expand Down
2 changes: 1 addition & 1 deletion lib/folio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def self.current_site(request: nil)
if Rails.application.config.folio_site_is_a_singleton
Folio::Site.instance
else
fail "You must implement this yourself"
fail "You must implement :current_site yourself"
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/folio/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Engine < ::Rails::Engine
end

initializer :append_migrations do |app|
unless app.root.to_s.include? root.to_s
unless app.root.to_s.include?(root.to_s + "/")
config.paths["db/migrate"].expanded.each do |expanded_path|
app.config.paths["db/migrate"] << expanded_path
end
Expand All @@ -124,7 +124,7 @@ class Engine < ::Rails::Engine
deprecations << "Missing index_folio_pages_on_by_query index on folio_pages. That is probably caused by using traco title_* attributes. Add a custom one."
end

if !Rails.env.test? && ActiveRecord::Base.connection.exec_query("SELECT id FROM folio_email_templates LIMIT 1;").rows.size == 0
if !Rails.env.test? && ActiveRecord::Base.connection.exec_query("SELECT id FROM folio_email_templates WHERE mailer ='Folio::DeviseMailer' LIMIT 1;").rows.size == 0
deprecations << "There are no email templates present. Seed them via rake folio:email_templates:idp_seed"
end
rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished, ActiveRecord::StatementInvalid
Expand Down

0 comments on commit a0d03d9

Please sign in to comment.