# HG changeset patch # User Goffi # Date 1599330205 -7200 # Node ID 19bad15f4c0aea68c8bbab1d52ef301da278dd21 # Parent cc6164a4973b02b5223f86ac2afaed71f3d13c5d plugin invitation: if "thumb_url" is not set, try to use one from list of interests diff -r cc6164a4973b -r 19bad15f4c0a sat/plugins/plugin_exp_invitation.py --- a/sat/plugins/plugin_exp_invitation.py Sat Sep 05 20:22:23 2020 +0200 +++ b/sat/plugins/plugin_exp_invitation.py Sat Sep 05 20:23:25 2020 +0200 @@ -175,6 +175,22 @@ except Exception as 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( client, invitee_jid, name, extra) file_sharing_elt = invitation_elt.addElement("file_sharing")