a TON of bugfixes and new features
This commit is contained in:
@@ -15,7 +15,12 @@ class Blogpost < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def editor
|
||||
# can be nil
|
||||
@editor ||= user_editor
|
||||
end
|
||||
|
||||
def edited?
|
||||
!!user_editor_id
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -16,4 +16,13 @@ class Comment < ActiveRecord::Base
|
||||
User.first
|
||||
end
|
||||
end
|
||||
|
||||
def editor
|
||||
# can be nil
|
||||
@editor ||= user_editor
|
||||
end
|
||||
|
||||
def edited?
|
||||
!!user_editor_id
|
||||
end
|
||||
end
|
||||
@@ -23,9 +23,14 @@ class Forumthread < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def editor
|
||||
# can be nil
|
||||
@editor ||= user_editor
|
||||
end
|
||||
|
||||
def edited?
|
||||
!!user_editor_id
|
||||
end
|
||||
|
||||
def replies
|
||||
threadreplies
|
||||
end
|
||||
|
||||
@@ -15,8 +15,14 @@ class Role < ActiveRecord::Base
|
||||
!!(Role.find_by_name(name) == self)
|
||||
end
|
||||
|
||||
def self.get (name)
|
||||
Role.find_by_name(name)
|
||||
def self.get (input)
|
||||
if input.is_a?(String) || input.is_a?(Symbol)
|
||||
Role.find_by_name(input)
|
||||
elsif input.is_a?(Fixnum)
|
||||
Role.find_by_id(input)
|
||||
elsif input.is_a?(Role)
|
||||
return input
|
||||
end
|
||||
end
|
||||
|
||||
def <=> (role)
|
||||
|
||||
@@ -21,6 +21,11 @@ class Threadreply < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def editor
|
||||
# can be nil
|
||||
@editor ||= user_editor
|
||||
end
|
||||
|
||||
def edited?
|
||||
!!user_editor_id
|
||||
end
|
||||
end
|
||||
@@ -7,7 +7,7 @@ class User < ActiveRecord::Base
|
||||
|
||||
has_secure_password
|
||||
|
||||
before_validation :strip_whitespaces, :set_uuid, :set_name, :set_role, :set_email_token
|
||||
before_validation :strip_whitespaces, :set_uuid, :set_name, :set_email_token
|
||||
|
||||
validates_presence_of :password, :password_confirmation, :email_token, :on => :create
|
||||
validates_presence_of :name, :email, :ign
|
||||
@@ -38,6 +38,10 @@ class User < ActiveRecord::Base
|
||||
!!self.confirmed
|
||||
end
|
||||
|
||||
def online?
|
||||
last_seen && last_seen > 5.minutes.ago
|
||||
end
|
||||
|
||||
#roles
|
||||
def disabled?
|
||||
!!(self.role == :disabled)
|
||||
@@ -179,10 +183,6 @@ class User < ActiveRecord::Base
|
||||
self.name ||= self.ign
|
||||
end
|
||||
|
||||
def set_role
|
||||
self.role ||= Role.get(:normal)
|
||||
end
|
||||
|
||||
def account_exists?
|
||||
profile = self.get_profile
|
||||
if !profile || profile["demo"] == true
|
||||
|
||||
Reference in New Issue
Block a user