Feature #42623 » 42623-fix-principal-initials.patch
| app/helpers/avatars_helper.rb | ||
|---|---|---|
|
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
|
||
| app/models/principal.rb | ||
|---|---|---|
|
to_s
|
||
|
end
|
||
|
# Returns nil by default, subclasses should implement this method
|
||
|
def initials(formatter = nil)
|
||
|
nil
|
||
|
end
|
||
|
def mail=(*args)
|
||
|
nil
|
||
|
end
|
||
| test/unit/principal_test.rb | ||
|---|---|---|
|
r = Principal.like('vi_ci')
|
||
|
assert_include user, r
|
||
|
end
|
||
|
def test_initials_should_return_nil
|
||
|
assert_nil Group.first.initials
|
||
|
end
|
||
|
end
|
||
- « Previous
- 1
- 2
- 3
- 4
- Next »