mirror of
https://github.com/neocities/neocities.git
synced 2025-08-05 01:01:30 +02:00
email settings tests, code cleanup
This commit is contained in:
parent
2dd3a34961
commit
5bb1b4f5b6
7 changed files with 136 additions and 28 deletions
33
app.rb
33
app.rb
|
@ -56,6 +56,7 @@ error do
|
|||
erb :'error'
|
||||
end
|
||||
|
||||
# :nocov:
|
||||
get '/newindex_mockup' do
|
||||
if SimpleCache.expired?(:sites_count)
|
||||
@sites_count = SimpleCache.store :sites_count, Site.count.roundup(100), 600 # 10 Minutes
|
||||
|
@ -79,6 +80,15 @@ get '/profile_mockup' do
|
|||
erb :'profile_mockup', locals: {site: current_site}
|
||||
end
|
||||
|
||||
get '/browse_mockup' do
|
||||
erb :'browse_mockup'
|
||||
end
|
||||
|
||||
get '/tips_mockup' do
|
||||
erb :'tips_mockup'
|
||||
end
|
||||
# :nocov:
|
||||
|
||||
get '/site/:username.rss' do |username|
|
||||
site = Site[username: username]
|
||||
content_type :xml
|
||||
|
@ -87,10 +97,7 @@ end
|
|||
|
||||
get '/site/:username/?' do |username|
|
||||
site = Site[username: username]
|
||||
not_found if site.nil?
|
||||
if current_site && (site.is_blocking?(current_site) || current_site.is_blocking?(site))
|
||||
not_found
|
||||
end
|
||||
not_found if site.nil? || site.is_banned
|
||||
|
||||
@title = site.title
|
||||
|
||||
|
@ -131,24 +138,14 @@ post '/site/:username/comment' do |username|
|
|||
redirect "/site/#{username}"
|
||||
end
|
||||
|
||||
DB.transaction do
|
||||
site.add_profile_comment(
|
||||
actioning_site_id: current_site.id,
|
||||
message: params[:message]
|
||||
)
|
||||
end
|
||||
site.add_profile_comment(
|
||||
actioning_site_id: current_site.id,
|
||||
message: params[:message]
|
||||
)
|
||||
|
||||
redirect "/site/#{username}"
|
||||
end
|
||||
|
||||
get '/browse_mockup' do
|
||||
erb :'browse_mockup'
|
||||
end
|
||||
|
||||
get '/tips_mockup' do
|
||||
erb :'tips_mockup'
|
||||
end
|
||||
|
||||
get '/stats/?' do
|
||||
require_admin
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue