mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-01 03:57:15 +00:00
Introduce active? method to Group via Principal model (#27510).
Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@22976 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
643b4ebb08
commit
9cc3542fa1
@ -136,6 +136,10 @@ class Principal < ApplicationRecord
|
||||
nil
|
||||
end
|
||||
|
||||
def active?
|
||||
self.status == STATUS_ACTIVE
|
||||
end
|
||||
|
||||
def visible?(user=User.current)
|
||||
Principal.visible(user).find_by(:id => id) == self
|
||||
end
|
||||
|
||||
@ -273,10 +273,6 @@ class User < Principal
|
||||
end
|
||||
end
|
||||
|
||||
def active?
|
||||
self.status == STATUS_ACTIVE
|
||||
end
|
||||
|
||||
def registered?
|
||||
self.status == STATUS_REGISTERED
|
||||
end
|
||||
|
||||
@ -38,6 +38,7 @@ class GroupTest < ActiveSupport::TestCase
|
||||
assert g.save
|
||||
g.reload
|
||||
assert_equal 'New group', g.name
|
||||
assert_equal true, g.active?
|
||||
end
|
||||
|
||||
def test_name_should_accept_255_characters
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user