Add private_chat_portal_meta option and fix bugs

* The new option is implicitly enabled when encryption is default
* Private chat metadata is now updated after creating the room too
* The puppet metadata is updated before creating the room, to make sure their
  name is available locally
This commit is contained in:
Tulir Asokan
2020-05-20 21:19:42 +03:00
parent 4d8d332732
commit 40beb8f752
5 changed files with 34 additions and 17 deletions
+6 -4
View File
@@ -242,8 +242,7 @@ class Puppet(CustomPuppetMixin):
try:
changed = await self.update_displayname(source, info) or changed
if isinstance(info.photo, UserProfilePhoto):
changed = await self.update_avatar(source, info.photo) or changed
changed = await self.update_avatar(source, info.photo) or changed
except Exception:
self.log.exception(f"Failed to update info from source {source.tgid}")
@@ -294,10 +293,13 @@ class Puppet(CustomPuppetMixin):
if self.disable_updates:
return False
if isinstance(photo, UserProfilePhotoEmpty):
if photo is None or isinstance(photo, UserProfilePhotoEmpty):
photo_id = ""
else:
elif isinstance(photo, UserProfilePhoto):
photo_id = str(photo.photo_id)
else:
self.log.warning(f"Unknown user profile photo type: {type(photo)}")
return False
if self.photo_id != photo_id:
if not photo_id:
self.photo_id = ""