models: set more creator names explicitly.

Set creators explicitly for bans, BURs, comment votes, and posts.
This commit is contained in:
evazion
2020-02-23 02:42:12 -06:00
parent 3a018ee9f7
commit e47d0e0d05
16 changed files with 18 additions and 64 deletions

View File

@@ -19,7 +19,6 @@ class ForumTopic < ApplicationRecord
has_many :moderation_reports, through: :posts
has_one :original_post, -> {order("forum_posts.id asc")}, class_name: "ForumPost", foreign_key: "topic_id", inverse_of: :topic
before_validation :initialize_is_deleted, :on => :create
validates_presence_of :title
validates_associated :original_post
validates_inclusion_of :category_id, :in => CATEGORIES.keys
@@ -151,10 +150,6 @@ class ForumTopic < ApplicationRecord
ModAction.log("undeleted forum topic ##{id} (title: #{title})", :forum_topic_undelete)
end
def initialize_is_deleted
self.is_deleted = false if is_deleted.nil?
end
def page_for(post_id)
(posts.where("id < ?", post_id).count / Danbooru.config.posts_per_page.to_f).ceil
end