Merge pull request #3502 from matrix-org/matthew/dinsic-tweak-display-names

tweak dinsic display names
This commit is contained in:
Michael Kaye 2018-07-10 15:59:26 +01:00 committed by GitHub
commit 261e4f2542
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -421,9 +421,17 @@ class RegisterRestServlet(RestServlet):
# XXX: a nasty heuristic to turn an email address into # XXX: a nasty heuristic to turn an email address into
# a displayname, as part of register_mxid_from_3pid # a displayname, as part of register_mxid_from_3pid
parts = address.replace('.', ' ').split('@') parts = address.replace('.', ' ').split('@')
org_parts = parts[1].split(' ')
if org_parts[-2] == "matrix" and org_parts[-1] == "org":
org = "Tchap Admin"
elif org_parts[-2] == "gouv" and org_parts[-1] == "fr":
org = org_parts[-3] if len(org_parts) > 2 else org_parts[-2]
else:
org = org_parts[-2]
desired_display_name = ( desired_display_name = (
capwords(parts[0]) + capwords(parts[0]) + " [" + capwords(org) + "]"
" [" + capwords(parts[1].split(' ')[0]) + "]"
) )
elif ( elif (
self.hs.config.register_mxid_from_3pid == 'msisdn' and self.hs.config.register_mxid_from_3pid == 'msisdn' and