mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 09:46:22 +00:00
chore: rubocop
This commit is contained in:
parent
5133eb1022
commit
ad7f55adf7
1 changed files with 9 additions and 9 deletions
|
@ -90,18 +90,20 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||||
|
|
||||||
def rename(name)
|
def rename(name)
|
||||||
return if name == site.name
|
return if name == site.name
|
||||||
|
|
||||||
moved = false
|
moved = false
|
||||||
site.name = name
|
site.name = name
|
||||||
|
|
||||||
Site.transaction do
|
Site.transaction do
|
||||||
raise ActiveRecord::Rollback if File.exists?(site.path)
|
raise ActiveRecord::Rollback if File.exist?(site.path)
|
||||||
|
|
||||||
FileUtils.mv(site.path_was, site.path)
|
FileUtils.mv(site.path_was, site.path)
|
||||||
moved = true
|
moved = true
|
||||||
ActiveStorage::Blob.where(service_name: site.name_was).update_all(service_name: site.name)
|
ActiveStorage::Blob.where(service_name: site.name_was).update_all(service_name: site.name)
|
||||||
site.save
|
site.save
|
||||||
rescue StandardError
|
rescue StandardError
|
||||||
FileUtils.mv(site.path, site.path_was) if moved
|
FileUtils.mv(site.path, site.path_was) if moved
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -239,9 +241,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
def with_all_locales
|
||||||
|
|
||||||
def with_all_locales(&block)
|
|
||||||
site.locales.map do |locale|
|
site.locales.map do |locale|
|
||||||
next unless I18n.available_locales.include? locale
|
next unless I18n.available_locales.include? locale
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue