Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/controllers/about_controller.rb - app/controllers/tags_controller.rb - app/views/about/show.html.haml - spec/views/about/show.html.haml_spec.rb
This commit is contained in:
@ -474,6 +474,7 @@ class Account < ApplicationRecord
|
||||
|
||||
before_create :generate_keys
|
||||
before_validation :prepare_contents, if: :local?
|
||||
before_validation :prepare_username, on: :create
|
||||
before_destroy :clean_feed_manager
|
||||
|
||||
private
|
||||
@ -483,6 +484,10 @@ class Account < ApplicationRecord
|
||||
note&.strip!
|
||||
end
|
||||
|
||||
def prepare_username
|
||||
username&.squish!
|
||||
end
|
||||
|
||||
def generate_keys
|
||||
return unless local? && !Rails.env.test?
|
||||
|
||||
|
@ -18,7 +18,11 @@ module Expireable
|
||||
end
|
||||
|
||||
def expired?
|
||||
!expires_at.nil? && expires_at < Time.now.utc
|
||||
expires? && expires_at < Time.now.utc
|
||||
end
|
||||
|
||||
def expires?
|
||||
!expires_at.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -72,6 +72,14 @@ class Tag < ApplicationRecord
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
end
|
||||
|
||||
def find_normalized(name)
|
||||
find_by(name: name.mb_chars.downcase.to_s)
|
||||
end
|
||||
|
||||
def find_normalized!(name)
|
||||
find_normalized(name) || raise(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
Reference in New Issue
Block a user