]> source.dussan.org Git - redmine.git/commitdiff
Introduce `active?` method to Group via Principal model (#27510).
authorGo MAEDA <maeda@farend.jp>
Wed, 21 Aug 2024 08:05:59 +0000 (08:05 +0000)
committerGo MAEDA <maeda@farend.jp>
Wed, 21 Aug 2024 08:05:59 +0000 (08:05 +0000)
Patch by Go MAEDA (user:maeda).

git-svn-id: https://svn.redmine.org/redmine/trunk@22976 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/principal.rb
app/models/user.rb
test/unit/group_test.rb

index 56da6d9c76e622526098d2c11c025639d289e865..6ea19e60ddff9059ceb04d094dcf93511ba70310 100644 (file)
@@ -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
index 0294e7d21eaef366c50cb6f422343cf9b1189513..c3f183fc7aa86f4b02907bb1b5f68a6af3e1888d 100644 (file)
@@ -273,10 +273,6 @@ class User < Principal
     end
   end
 
-  def active?
-    self.status == STATUS_ACTIVE
-  end
-
   def registered?
     self.status == STATUS_REGISTERED
   end
index 0e5288f1b6727a5fe0279b1cf40aed89d6598003..59923927c0bdc0665bbc5b0b2843cc77e6508a4f 100644 (file)
@@ -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