added pixiv proxy, report mailer
This commit is contained in:
@@ -9,7 +9,8 @@ class Comment < ActiveRecord::Base
|
||||
attr_accessor :do_not_bump_post
|
||||
|
||||
scope :recent, :order => "comments.id desc", :limit => 6
|
||||
scope :search_body, lambda {|query| {:conditions => ["body_index @@ plainto_tsquery(?)", query], :order => "id desc"}}
|
||||
scope :search_body, lambda {|query| where("body_index @@ plainto_tsquery(?)", query)}
|
||||
scope :hidden, lambda {|user| where("score < ?", user.comment_threshold)}
|
||||
|
||||
def update_last_commented_at
|
||||
return if do_not_bump_post
|
||||
|
||||
@@ -42,9 +42,9 @@ class Note < ActiveRecord::Base
|
||||
|
||||
def update_post
|
||||
if Note.exists?(["is_active = ? AND post_id = ?", true, post_id])
|
||||
Post.update(post_id, :last_noted_at => updated_at, :updater_id => updater_id, :updater_ip_addr => updater_ip_addr)
|
||||
execute_sql("UPDATE posts SET last_noted_at = ? WHERE id = ?", updated_at, post_id)
|
||||
else
|
||||
Post.update(post_id, :last_noted_at => nil, :updater_id => updater_id, :updater_ip_addr => updater_ip_addr)
|
||||
execute_sql("UPDATE posts SET last_noted_at = NULL WHERE id = ?", post_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -499,6 +499,20 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
module CountMethods
|
||||
def fast_count(tags)
|
||||
Cache.get("pfc:#{Cache.sanitize(tags)}", 24.hours) do
|
||||
Post.find_by_tags(tags).count
|
||||
end
|
||||
end
|
||||
|
||||
def fast_delete_count(tags)
|
||||
Cache.get("pfdc:#{Cache.sanitize(tags)}", 24.hours) do
|
||||
Post.find_by_tags("#{tags} status:deleted").count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
include FileMethods
|
||||
include ImageMethods
|
||||
include ModerationMethods
|
||||
@@ -510,6 +524,7 @@ class Post < ActiveRecord::Base
|
||||
include PoolMethods
|
||||
extend SearchMethods
|
||||
include VoteMethods
|
||||
extend CountMethods
|
||||
|
||||
def reload(options = nil)
|
||||
super
|
||||
|
||||
7
app/models/report_mailer.rb
Normal file
7
app/models/report_mailer.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class ReportMailer < ActionMailer::Base
|
||||
default :host => Danbooru.config.server_host, :from => Danbooru.config.contact_email, :content_type => "text/html"
|
||||
|
||||
def moderator_report(email)
|
||||
mail(:to => email, :subject => "#{Danbooru.config.app_name} - Moderator Report")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user