plugin invitation: if "thumb_url" is not set, try to use one from list of interests
This commit is contained in:
parent
6f139b80e1
commit
5ec9d7ffec
1 changed files with 16 additions and 0 deletions
|
|
@ -175,6 +175,22 @@ class Invitation(object):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning(f"Can't set affiliation: {e}")
|
log.warning(f"Can't set affiliation: {e}")
|
||||||
|
|
||||||
|
if "thumb_url" not in extra:
|
||||||
|
# we have no thumbnail, we check in our own list of interests if there is one
|
||||||
|
try:
|
||||||
|
item_id = li_plg.getFileSharingId(service, namespace, path)
|
||||||
|
own_interest = await li_plg.get(client, item_id)
|
||||||
|
except exceptions.NotFound:
|
||||||
|
log.debug(
|
||||||
|
"no thumbnail found for file sharing interest at "
|
||||||
|
f"[{service}/{namespace}]{path}"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
extra['thumb_url'] = own_interest['thumb_url']
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
mess_data, invitation_elt = self._generateBaseInvitation(
|
mess_data, invitation_elt = self._generateBaseInvitation(
|
||||||
client, invitee_jid, name, extra)
|
client, invitee_jid, name, extra)
|
||||||
file_sharing_elt = invitation_elt.addElement("file_sharing")
|
file_sharing_elt = invitation_elt.addElement("file_sharing")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue