mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
catch already created records errors
This commit is contained in:
parent
262fc34bb9
commit
bca7ecb95f
2 changed files with 11 additions and 5 deletions
|
@ -52,7 +52,10 @@ post '/site_files/create' do
|
||||||
end
|
end
|
||||||
|
|
||||||
if extname.match(/^\.html|^\.htm/i)
|
if extname.match(/^\.html|^\.htm/i)
|
||||||
current_site.install_new_html_file name
|
begin
|
||||||
|
current_site.install_new_html_file name
|
||||||
|
rescue Sequel::UniqueConstraintViolation
|
||||||
|
end
|
||||||
else
|
else
|
||||||
file_path = current_site.files_path(name)
|
file_path = current_site.files_path(name)
|
||||||
FileUtils.touch file_path
|
FileUtils.touch file_path
|
||||||
|
|
|
@ -411,10 +411,13 @@ class Site < Sequel::Model
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
DB.transaction do
|
DB.transaction do
|
||||||
follow = add_following site_id: site.id
|
begin
|
||||||
# FIXME see above.
|
follow = add_following site_id: site.id
|
||||||
# DB['update sites set follow_count=follow_count+1 where id=?', site.id].first if scorable_follow?(site)
|
# FIXME see above.
|
||||||
Event.create site_id: site.id, actioning_site_id: self.id, follow_id: follow.id
|
# DB['update sites set follow_count=follow_count+1 where id=?', site.id].first if scorable_follow?(site)
|
||||||
|
Event.create site_id: site.id, actioning_site_id: self.id, follow_id: follow.id
|
||||||
|
rescue Sequel::UniqueConstraintViolation
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
Loading…
Add table
Reference in a new issue