# HG changeset patch # User Daniel Dourvaris # Date 2017-08-25 08:27:00 # Node ID 623ff10e7df4d8182305acd266aadfef43c30c25 # Parent 5669774a71ccf6364b105df4f878e17a4fed95c1 initial-gravatars: fix case of dot beeing present before @domain. diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -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]] diff --git a/rhodecode/tests/other/test_libs.py b/rhodecode/tests/lib/test_libs.py rename from rhodecode/tests/other/test_libs.py rename to rhodecode/tests/lib/test_libs.py --- a/rhodecode/tests/other/test_libs.py +++ b/rhodecode/tests/lib/test_libs.py @@ -281,6 +281,7 @@ def test_gravatar_url_builder(tmpl_url, ('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):