mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
de-prioritize shooting yourself in the foot
This commit is contained in:
parent
08026ac235
commit
19ad676df6
3 changed files with 33 additions and 5 deletions
4
app.rb
4
app.rb
|
@ -1154,11 +1154,9 @@ end
|
|||
post '/site/delete' do
|
||||
require_login
|
||||
if current_site.username != params[:username]
|
||||
errors.add :username, 'Could not delete site, site name did not match.'
|
||||
current_site.errors.add :username, 'Could not delete site, site name did not match.'
|
||||
halt erb(:settings)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def require_admin
|
||||
|
|
|
@ -209,16 +209,45 @@ class Site < Sequel::Model
|
|||
File.read file_path(filename)
|
||||
end
|
||||
|
||||
def before_destroy
|
||||
raise 'not finished'
|
||||
DB.transaction {
|
||||
remove_all_tags
|
||||
profile_comments.destroy
|
||||
profile_commentings.destroy
|
||||
follows.destroy
|
||||
followings.destroy
|
||||
#tips.destroy
|
||||
#tippings.destroy
|
||||
#blocks.destroy
|
||||
#blockings.destroy
|
||||
#reports.destroy
|
||||
#reportings.destroy
|
||||
#stats.destroy
|
||||
#events.destroy
|
||||
#site_changes.destroy
|
||||
# TODO FIND THE REST, ASSOCIATE THEM PROPERLY!!!
|
||||
}
|
||||
end
|
||||
|
||||
def delete_site!
|
||||
raise 'not finished'
|
||||
DB.transaction {
|
||||
destroy
|
||||
FileUtils.mv files_path, File.join(PUBLIC_ROOT, 'deleted_sites', username)
|
||||
}
|
||||
end
|
||||
|
||||
def ban!
|
||||
if username.nil? || username.empty?
|
||||
raise 'username is missing'
|
||||
end
|
||||
|
||||
DB.transaction {
|
||||
FileUtils.mv files_path, File.join(PUBLIC_ROOT, 'banned_sites', username)
|
||||
self.is_banned = true
|
||||
self.updated_at = Time.now
|
||||
save(validate: false)
|
||||
FileUtils.mv files_path, File.join(PUBLIC_ROOT, 'banned_sites', username)
|
||||
}
|
||||
|
||||
site_files.file_list.collect {|f| f.filename}.each do |f|
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
|
||||
<input class="btn-Action" type="submit" value="Update">
|
||||
</form>
|
||||
|
||||
<!--
|
||||
<h2>Delete Site</h2>
|
||||
<p class="tiny">
|
||||
If you want to delete your account, you can do that here. We're sorry to see you go, but we understand if Neocities isn't right for you. If there's any specific reason you're leaving, it would be great if you <a href="/contact">let us know</a> so we can try to make your experience better in the future.
|
||||
|
@ -119,6 +119,7 @@
|
|||
<div>
|
||||
<a href="#deleteSite" data-toggle="modal" class="btn">Delete Site</a>
|
||||
</div>
|
||||
-->
|
||||
</section>
|
||||
</article>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue