diff --git a/app/models/post.rb b/app/models/post.rb index 020ef2469..4662a4ea0 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -866,7 +866,7 @@ class Post < ActiveRecord::Base end def pending_or_flagged - where("(is_pending = ? OR is_flagged = ?)", true, true) + where("(is_pending = true OR (is_flagged = true and is_deleted = false))") end def undeleted diff --git a/config/deploy.rb b/config/deploy.rb index 7c7175d7a..7d6f88179 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -82,10 +82,7 @@ namespace :deploy do namespace :nginx do desc "Shut down Nginx" task :stop do - pids = capture("pgrep -f nginx").scan(/\d+/) - pids.each do |pid| - sudo "kill -SIGTERM #{pid}" - end + sudo "/etc/init.d/nginx stop" end desc "Start Nginx" diff --git a/script/fixes/001.sql b/script/fixes/001.sql index 370e513d1..f261bb412 100644 --- a/script/fixes/001.sql +++ b/script/fixes/001.sql @@ -1,3 +1,3 @@ set statement_timeout = 0; -update posts set is_pending = false where is_deleted = true; +update posts set is_pending = false where is_deleted = true and is_pending = true; update posts set last_commented_at = null where last_commented_at is not null and not exists (select 1 from comments _ where _.post_id = posts.id limit 1);