Merge remote-tracking branch 'origin/main' into feature/047
This commit is contained in:
@@ -4,11 +4,7 @@ class IpAddress < ApplicationRecord
|
||||
has_many :user_ips, dependent: :destroy
|
||||
has_many :users, through: :user_ips
|
||||
|
||||
def banned? = banned_at?
|
||||
def banned = banned?
|
||||
|
||||
def banned= value
|
||||
bool = ActiveModel::Type::Boolean.new.cast(value)
|
||||
self.banned_at = bool ? banned_at || Time.current : nil
|
||||
end
|
||||
def banned? = banned_at.present?
|
||||
def ban! = banned? || update!(banned_at: Time.current)
|
||||
def unban! = update!(banned_at: nil)
|
||||
end
|
||||
|
||||
@@ -79,6 +79,8 @@ class Tag < ApplicationRecord
|
||||
|
||||
def material_id = materials.first&.id
|
||||
|
||||
def has_deerjikists = deerjikists.present?
|
||||
|
||||
def self.tagme = find_or_create_by_tag_name!('タグ希望', category: :meta)
|
||||
def self.bot = find_or_create_by_tag_name!('bot操作', category: :meta)
|
||||
def self.no_deerjikist = find_or_create_by_tag_name!('ニジラー情報不詳', category: :meta)
|
||||
|
||||
@@ -17,14 +17,11 @@ class User < ApplicationRecord
|
||||
has_many :updated_wiki_pages,
|
||||
class_name: 'WikiPage', foreign_key: :updated_user_id, dependent: :nullify
|
||||
|
||||
def banned? = banned_at?
|
||||
def banned = banned?
|
||||
|
||||
def banned= value
|
||||
bool = ActiveModel::Type::Boolean.new.cast(value)
|
||||
self.banned_at = bool ? (banned_at || Time.current) : nil
|
||||
end
|
||||
|
||||
def viewed?(post) = user_post_views.exists?(post_id: post.id)
|
||||
|
||||
def gte_member? = member? || admin?
|
||||
|
||||
def banned? = banned_at.present?
|
||||
def ban! = banned? || update!(banned_at: Time.current)
|
||||
def unban! = update!(banned_at: nil)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user