From 83e3196e5561fdc4357140f5ab753b5f0bcd0293 Mon Sep 17 00:00:00 2001 From: Daniel Dourvaris Date: Fri, 25 Aug 2017 10:27:00 +0200 Subject: [PATCH] initial-gravatars: fix case of dot beeing present before @domain. --- rhodecode/lib/helpers.py | 2 +- rhodecode/tests/{other => lib}/test_libs.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) rename rhodecode/tests/{other => lib}/test_libs.py (99%) diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py index d6e50f23..01b39c59 100644 --- 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 similarity index 99% rename from rhodecode/tests/other/test_libs.py rename to rhodecode/tests/lib/test_libs.py index d07ba65c..2135048b 100644 --- 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, 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):