mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
id_to_username cleanup
This commit is contained in:
parent
b05f2e99e8
commit
3e38fecd55
1 changed files with 4 additions and 4 deletions
|
@ -116,12 +116,12 @@ def get_isni(existing, author, autoescape=True):
|
|||
|
||||
@register.simple_tag(takes_context=False)
|
||||
def id_to_username(user_id):
|
||||
"""given an arbitrary user id, return the username"""
|
||||
"""given an arbitrary remote id, return the username"""
|
||||
if user_id:
|
||||
url = urlparse(user_id)
|
||||
domain = url.netloc
|
||||
parts = url.path.split("/")
|
||||
name = parts[-1]
|
||||
return f"{name}@{domain}"
|
||||
else:
|
||||
return None
|
||||
value = f"{name}@{domain}"
|
||||
|
||||
return value
|
||||
|
|
Loading…
Reference in a new issue