mirror of
https://github.com/neocities/neocities.git
synced 2025-08-04 08:42:00 +02:00
fix site unblocking
This commit is contained in:
parent
b54b2a4818
commit
6ea07df6a8
5 changed files with 39 additions and 13 deletions
|
@ -68,28 +68,28 @@ def browse_sites_dataset
|
|||
ds = ds.exclude featured_at: nil
|
||||
ds = ds.order :featured_at.desc
|
||||
when 'hits'
|
||||
ds = ds.where{views > 100}
|
||||
ds = ds.where{views > Site::BROWSE_MINIMUM_VIEWS}
|
||||
ds = ds.order(:hits.desc, :site_updated_at.desc)
|
||||
when 'views'
|
||||
ds = ds.where{views > 100}
|
||||
ds = ds.where{views > Site::BROWSE_MINIMUM_VIEWS}
|
||||
ds = ds.order(:views.desc, :site_updated_at.desc)
|
||||
when 'newest'
|
||||
ds = ds.order(:created_at.desc, :views.desc)
|
||||
when 'oldest'
|
||||
ds = ds.where{views > 100}
|
||||
ds = ds.where{views > Site::BROWSE_MINIMUM_VIEWS}
|
||||
ds = ds.order(:created_at, :views.desc)
|
||||
when 'random'
|
||||
ds = ds.where{views > 100}
|
||||
ds = ds.where{views > Site::BROWSE_MINIMUM_VIEWS}
|
||||
ds = ds.where 'random() < 0.01'
|
||||
when 'last_updated'
|
||||
ds = ds.where{views > 100}
|
||||
ds = ds.where{views > Site::BROWSE_MINIMUM_VIEWS}
|
||||
params[:sort_by] = 'last_updated'
|
||||
ds = ds.exclude(site_updated_at: nil)
|
||||
ds = ds.order(:site_updated_at.desc, :views.desc)
|
||||
when 'tipping_enabled'
|
||||
ds = ds.where tipping_enabled: true
|
||||
ds = ds.where("(tipping_paypal is not null and tipping_paypal != '') or (tipping_bitcoin is not null and tipping_bitcoin != '')")
|
||||
ds = ds.where{views > 10_000}
|
||||
ds = ds.where{views > Site::BROWSE_MINIMUM_FOLLOWER_VIEWS}
|
||||
ds = ds.group :sites__id
|
||||
ds = ds.order :follow_count.desc, :views.desc, :updated_at.desc
|
||||
when 'blocks'
|
||||
|
@ -100,7 +100,7 @@ def browse_sites_dataset
|
|||
ds = ds.order :total.desc
|
||||
else
|
||||
params[:sort_by] = 'followers'
|
||||
ds = ds.where{views > 10_000}
|
||||
ds = ds.where{views > Site::BROWSE_MINIMUM_FOLLOWER_VIEWS}
|
||||
ds = ds.order :follow_count.desc, :views.desc, :updated_at.desc
|
||||
end
|
||||
|
||||
|
|
12
app/site.rb
12
app/site.rb
|
@ -284,3 +284,15 @@ post '/site/:username/block' do |username|
|
|||
redirect request.referer
|
||||
end
|
||||
end
|
||||
|
||||
get '/site/:username/unblock' do |username|
|
||||
require_login
|
||||
site = Site[username: username]
|
||||
|
||||
if site.nil? || current_site.id == site.id
|
||||
redirect request.referer
|
||||
end
|
||||
|
||||
current_site.unblock! site
|
||||
redirect request.referer
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue