mirror of
https://github.com/meineerde/redmine.git
synced 2025-10-17 17:01:01 +00:00
Adds method @initials@ to @Principal@ and return @nil@ by default (#42623).
git-svn-id: https://svn.redmine.org/redmine/trunk@23888 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
e940540e2e
commit
ae3cb747bb
@ -44,7 +44,7 @@ module AvatarsHelper
|
||||
if user.respond_to?(:mail)
|
||||
email = user.mail
|
||||
options[:title] = user.name unless options[:title]
|
||||
options[:initials] = user.initials if options[:default] == "initials"
|
||||
options[:initials] = user.initials if options[:default] == "initials" && user.initials.present?
|
||||
elsif user.to_s =~ %r{<(.+?)>}
|
||||
email = $1
|
||||
end
|
||||
|
||||
@ -130,6 +130,11 @@ class Principal < ApplicationRecord
|
||||
to_s
|
||||
end
|
||||
|
||||
# Returns nil by default, subclasses should implement this method
|
||||
def initials(formatter = nil)
|
||||
nil
|
||||
end
|
||||
|
||||
def mail=(*args)
|
||||
nil
|
||||
end
|
||||
|
||||
@ -166,4 +166,8 @@ class PrincipalTest < ActiveSupport::TestCase
|
||||
r = Principal.like('vi_ci')
|
||||
assert_include user, r
|
||||
end
|
||||
|
||||
def test_initials_should_return_nil
|
||||
assert_nil Group.first.initials
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user