plugin XEP-0277: "user" part of author jid is used for author name when later is missing
This commit is contained in:
parent
2155acd45b
commit
510e3e9bdc
1 changed files with 8 additions and 1 deletions
|
|
@ -448,7 +448,7 @@ class XEP_0277(object):
|
|||
"No name element found in author element of item {}".format(id_)
|
||||
)
|
||||
else:
|
||||
microblog_data["author"] = str(name_elt)
|
||||
author = microblog_data["author"] = str(name_elt).strip()
|
||||
# uri
|
||||
try:
|
||||
uri_elt = next(author_elt.elements(NS_ATOM, "uri"))
|
||||
|
|
@ -467,6 +467,13 @@ class XEP_0277(object):
|
|||
microblog_data["author_jid"] = (
|
||||
item_elt.getAttribute("publisher") or ""
|
||||
)
|
||||
if not author and microblog_data["author_jid"]:
|
||||
# FIXME: temporary workaround for missing author name, would be
|
||||
# better to use directly JID's identity (to be done from frontends?)
|
||||
try:
|
||||
microblog_data["author"] = jid.JID(microblog_data["author_jid"]).user
|
||||
except Exception as e:
|
||||
log.warning(f"No author name found, and can't parse author jid: {e}")
|
||||
|
||||
if not publisher:
|
||||
log.debug("No publisher attribute, we can't verify author jid")
|
||||
|
|
|
|||
Loading…
Reference in a new issue