mirror of
https://0xacab.org/sutty/sutty
synced 2025-03-19 21:48:20 +00:00
Merge branch 'issue-13077' into production.panel.sutty.nl
This commit is contained in:
commit
7ff8358e9a
1 changed files with 11 additions and 9 deletions
|
@ -97,18 +97,20 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
|||
|
||||
def rename(name)
|
||||
return if name == site.name
|
||||
|
||||
moved = false
|
||||
site.name = name
|
||||
|
||||
Site.transaction do
|
||||
raise ActiveRecord::Rollback if File.exists?(site.path)
|
||||
FileUtils.mv (site.path_was, site.path)
|
||||
raise ActiveRecord::Rollback if File.exist?(site.path)
|
||||
|
||||
FileUtils.mv(site.path_was, site.path)
|
||||
moved = true
|
||||
ActiveStorage::Blob.where(service_name: site.name_was).update_all(service_name: site.name)
|
||||
site.save
|
||||
rescue StandardError
|
||||
FileUtils.mv (site.path, site.path_was) if moved
|
||||
raise
|
||||
site.save
|
||||
rescue StandardError
|
||||
FileUtils.mv(site.path, site.path_was) if moved
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -254,7 +256,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
|||
@current_role ||= usuarie.rol_for_site(site)
|
||||
end
|
||||
|
||||
def with_all_locales(&block)
|
||||
def with_all_locales
|
||||
site.locales.map do |locale|
|
||||
next unless I18n.available_locales.include? locale
|
||||
|
||||
|
|
Loading…
Reference in a new issue