mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +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
|
post '/site/delete' do
|
||||||
require_login
|
require_login
|
||||||
if current_site.username != params[:username]
|
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)
|
halt erb(:settings)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def require_admin
|
def require_admin
|
||||||
|
|
|
@ -209,16 +209,45 @@ class Site < Sequel::Model
|
||||||
File.read file_path(filename)
|
File.read file_path(filename)
|
||||||
end
|
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!
|
def ban!
|
||||||
if username.nil? || username.empty?
|
if username.nil? || username.empty?
|
||||||
raise 'username is missing'
|
raise 'username is missing'
|
||||||
end
|
end
|
||||||
|
|
||||||
DB.transaction {
|
DB.transaction {
|
||||||
FileUtils.mv files_path, File.join(PUBLIC_ROOT, 'banned_sites', username)
|
|
||||||
self.is_banned = true
|
self.is_banned = true
|
||||||
self.updated_at = Time.now
|
self.updated_at = Time.now
|
||||||
save(validate: false)
|
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|
|
site_files.file_list.collect {|f| f.filename}.each do |f|
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
|
|
||||||
<input class="btn-Action" type="submit" value="Update">
|
<input class="btn-Action" type="submit" value="Update">
|
||||||
</form>
|
</form>
|
||||||
|
<!--
|
||||||
<h2>Delete Site</h2>
|
<h2>Delete Site</h2>
|
||||||
<p class="tiny">
|
<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.
|
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>
|
<div>
|
||||||
<a href="#deleteSite" data-toggle="modal" class="btn">Delete Site</a>
|
<a href="#deleteSite" data-toggle="modal" class="btn">Delete Site</a>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue