fixes for upgrade schema script
This commit is contained in:
@@ -14,7 +14,7 @@ class PostFlagsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
@post_flag = PostFlag.create(params[:post_flag])
|
||||
@post_flag = PostFlag.create(params[:post_flag].merge(:is_resolved => false))
|
||||
respond_with(@post_flag)
|
||||
end
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ module Moderator
|
||||
FROM post_versions
|
||||
JOIN users ON users.id = post_versions.updater_id
|
||||
WHERE
|
||||
post_versions.created_at > ?
|
||||
post_versions.updated_at > ?
|
||||
AND users.level <= ?
|
||||
GROUP BY post_versions.updater_id
|
||||
ORDER BY count(*) DESC
|
||||
|
||||
@@ -292,7 +292,7 @@ class Post < ActiveRecord::Base
|
||||
raise PostFlag::Error.new("Post is locked and cannot be flagged")
|
||||
end
|
||||
|
||||
flag = flags.create(:reason => reason)
|
||||
flag = flags.create(:reason => reason, :is_resolved => false)
|
||||
|
||||
if flag.errors.any?
|
||||
raise PostFlag::Error.new(flag.errors.full_messages.join("; "))
|
||||
|
||||
@@ -343,7 +343,7 @@ class Tag < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def should_update_related?
|
||||
related_tags.blank? || related_tags_updated_at < related_cache_expiry.hours.ago
|
||||
related_tags.blank? || related_tags_updated_at.blank? || related_tags_updated_at < related_cache_expiry.hours.ago
|
||||
end
|
||||
|
||||
def related_tag_array
|
||||
|
||||
@@ -26,7 +26,6 @@ class User < ActiveRecord::Base
|
||||
validates_confirmation_of :password
|
||||
validates_presence_of :email, :if => lambda {|rec| rec.new_record? && Danbooru.config.enable_email_verification?}
|
||||
validate :validate_ip_addr_is_not_banned, :on => :create
|
||||
before_validation :convert_blank_email_to_null
|
||||
before_validation :normalize_blacklisted_tags
|
||||
before_create :encrypt_password_on_create
|
||||
before_update :encrypt_password_on_update
|
||||
@@ -303,12 +302,6 @@ class User < ActiveRecord::Base
|
||||
raise User::Error.new("Verification key does not match")
|
||||
end
|
||||
end
|
||||
|
||||
def convert_blank_email_to_null
|
||||
if email.blank?
|
||||
self.email = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module BlacklistMethods
|
||||
|
||||
Reference in New Issue
Block a user