From c9e287fe35e621aeb797e8fc52d2074d5a8dbbd1 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Sun, 14 Jul 2013 02:14:10 -0400 Subject: [PATCH] filter based on site changed rather than time updated --- app.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app.rb b/app.rb index 06e3a727..b4f804d1 100644 --- a/app.rb +++ b/app.rb @@ -37,7 +37,7 @@ end get '/browse' do @current_page = params[:current_page] || 1 @current_page = @current_page.to_i - site_dataset = Site.order(:updated_at.desc, :hits.desc).filter(is_banned: false).filter(~{updated_at: nil}).paginate(@current_page, 201) + site_dataset = Site.order(:updated_at.desc, :hits.desc).filter(is_banned: false).filter(site_changed: true).paginate(@current_page, 201) site_dataset.filter! is_nsfw: (!params[:is_nsfw].nil? ? true : false) @@ -260,7 +260,10 @@ post '/site_files/upload' do FileUtils.mv params[:newfile][:tempfile].path, dest_path File.chmod(0640, dest_path) if self.class.production? - ScreenshotWorker.perform_async(current_site.username) if sanitized_filename =~ /index\.html/ + if sanitized_filename =~ /index\.html/ + ScreenshotWorker.perform_async current_site.username + current_site.update site_changed: true + end current_site.update updated_at: Time.now @@ -327,7 +330,10 @@ post '/site_files/save/:filename' do |filename| FileUtils.mv tmpfile.path, dest_path File.chmod(0640, dest_path) if self.class.production? - ScreenshotWorker.perform_async(current_site.username) if sanitized_filename =~ /index\.html/ + if sanitized_filename =~ /index\.html/ + ScreenshotWorker.perform_async current_site.username + current_site.update site_changed: true + end current_site.update updated_at: Time.now