models: set more creator names explicitly.
Set creators explicitly for bans, BURs, comment votes, and posts.
This commit is contained in:
@@ -8,7 +8,6 @@ class Ban < ApplicationRecord
|
||||
belongs_to :banner, :class_name => "User"
|
||||
validate :user_is_inferior
|
||||
validates_presence_of :reason, :duration
|
||||
before_validation :initialize_banner_id, :on => :create
|
||||
|
||||
scope :unexpired, -> { where("bans.expires_at > ?", Time.now) }
|
||||
scope :expired, -> { where("bans.expires_at <= ?", Time.now) }
|
||||
@@ -50,10 +49,6 @@ class Ban < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_banner_id
|
||||
self.banner_id = CurrentUser.id if self.banner_id.blank?
|
||||
end
|
||||
|
||||
def user_is_inferior
|
||||
if user
|
||||
if user.is_admin?
|
||||
|
||||
Reference in New Issue
Block a user