mirror of
https://git.ugnet.gay/CrossTalk/azul.git
synced 2026-11-25 08:09:55 +00:00
fix the fix
This commit is contained in:
1 parent
6451bb9426
commit
5a896451fc
3 files changed
+34
-4
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
{% from 'msn:_funcs.xml' import contact_entry, group_entry, generate_me_entry, ab_properties -%}
|
{% from 'msn:_funcs.xml' import contact_entry, group_entry, generate_me_entry, ab_properties with context -%}
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
<soap:Header>
|
<soap:Header>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{% from 'msn:_funcs.xml' import contact_entry, group_entry, generate_me_entry -%}
|
{% from 'msn:_funcs.xml' import contact_entry, group_entry, generate_me_entry with context -%}
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
<soap:Header>
|
<soap:Header>
|
||||||
|
|||||||
+32
-2
@@ -13,8 +13,38 @@ def render(req: web.Request, tmpl_name: str, ctxt: Optional[Dict[str, Any]] = No
|
|||||||
tmpl = req.app['jinja_env'].get_template(tmpl_name)
|
tmpl = req.app['jinja_env'].get_template(tmpl_name)
|
||||||
template_context = dict(ctxt or {})
|
template_context = dict(ctxt or {})
|
||||||
backend = req.app.get('backend')
|
backend = req.app.get('backend')
|
||||||
if backend is not None:
|
|
||||||
template_context['display_email'] = display_email
|
def display_email(user: Any, fallback: Optional[str] = None) -> str:
|
||||||
|
if isinstance(user, str):
|
||||||
|
identifier = user
|
||||||
|
if backend is None:
|
||||||
|
return fallback or (identifier if '@' in identifier else '')
|
||||||
|
user = backend.user_service.get(identifier)
|
||||||
|
if user is None and fallback:
|
||||||
|
uuid = backend.user_service.get_uuid(fallback)
|
||||||
|
if uuid is not None:
|
||||||
|
user = backend.user_service.get(uuid)
|
||||||
|
if user is None:
|
||||||
|
return fallback or (identifier if '@' in identifier else '')
|
||||||
|
elif user is None and fallback and backend is not None:
|
||||||
|
uuid = backend.user_service.get_uuid(fallback)
|
||||||
|
if uuid is not None:
|
||||||
|
user = backend.user_service.get(uuid)
|
||||||
|
|
||||||
|
if user is None:
|
||||||
|
return fallback or ''
|
||||||
|
|
||||||
|
if backend is not None:
|
||||||
|
return backend.util_get_display_email(user)
|
||||||
|
|
||||||
|
if getattr(user, 'alias_active', False):
|
||||||
|
username = getattr(user, 'username', None)
|
||||||
|
if username:
|
||||||
|
return '{}@crosstalk.im'.format(username)
|
||||||
|
|
||||||
|
return getattr(user, 'email', None) or fallback or ''
|
||||||
|
|
||||||
|
template_context['display_email'] = display_email
|
||||||
content = tmpl.render(**template_context)
|
content = tmpl.render(**template_context)
|
||||||
return web.Response(status = status, content_type = content_type, text = content)
|
return web.Response(status = status, content_type = content_type, text = content)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user