initial-gravatars: fix case of dot beeing present before @domain.
This commit is contained in:
parent
ebbfb35adf
commit
83e3196e55
2 changed files with 2 additions and 1 deletions
|
|
@ -1151,7 +1151,7 @@ class InitialsGravatar(object):
|
|||
|
||||
# check if prefix is maybe a 'first_name.last_name' syntax
|
||||
_dot_split = prefix.rsplit('.', 1)
|
||||
if len(_dot_split) == 2:
|
||||
if len(_dot_split) == 2 and _dot_split[1]:
|
||||
initials = [_dot_split[0][0], _dot_split[1][0]]
|
||||
else:
|
||||
initials = [prefix[0], server[0]]
|
||||
|
|
|
|||
|
|
@ -281,6 +281,7 @@ def test_gravatar_url_builder(tmpl_url, email, expected, request_stub):
|
|||
('admin@', 'Marcin', 'Śuzminski', 'MS', '#aa00ff'),
|
||||
('marcin.śuzminski', '', '', 'MS', '#402020'),
|
||||
('null', '', '', 'NL', '#8c4646'),
|
||||
('some.@abc.com', 'some', '', 'SA', '#664e33')
|
||||
])
|
||||
def test_initials_gravatar_pick_of_initials_and_color_algo(
|
||||
email, first_name, last_name, expected_initials, expected_color):
|
||||
Loading…
Add table
Add a link
Reference in a new issue