diff options
author | Erik Johnston <erikj@jki.re> | 2017-08-25 15:52:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-25 15:52:42 +0100 |
commit | 6d8799af1a3a4be960b1358e0c9cb14ffac64dad (patch) | |
tree | dff5504b581e2ad7e447ed3e91d688d371b21506 /synapse/groups | |
parent | Merge pull request #2410 from matrix-org/erikj/groups_publicise (diff) | |
parent | Fix typos and reinherit (diff) | |
download | synapse-6d8799af1a3a4be960b1358e0c9cb14ffac64dad.tar.xz |
Merge pull request #2429 from matrix-org/erikj/groups_profile_cache
Add a remote user profile cache
Diffstat (limited to 'synapse/groups')
-rw-r--r-- | synapse/groups/groups_server.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/groups/groups_server.py b/synapse/groups/groups_server.py index f25f327eb9..6bccae4bfb 100644 --- a/synapse/groups/groups_server.py +++ b/synapse/groups/groups_server.py @@ -503,6 +503,13 @@ class GroupsServerHandler(object): get_domain_from_id(user_id), group_id, user_id, content ) + user_profile = res.get("user_profile", {}) + yield self.store.add_remote_profile_cache( + user_id, + displayname=user_profile.get("displayname"), + avatar_url=user_profile.get("avatar_url"), + ) + if res["state"] == "join": if not self.hs.is_mine_id(user_id): remote_attestation = res["attestation"] @@ -627,6 +634,9 @@ class GroupsServerHandler(object): get_domain_from_id(user_id), group_id, user_id, {} ) + if not self.hs.is_mine_id(user_id): + yield self.store.maybe_delete_remote_profile_cache(user_id) + defer.returnValue({}) @defer.inlineCallbacks @@ -647,6 +657,7 @@ class GroupsServerHandler(object): avatar_url = profile.get("avatar_url") short_description = profile.get("short_description") long_description = profile.get("long_description") + user_profile = content.get("user_profile", {}) yield self.store.create_group( group_id, @@ -679,6 +690,13 @@ class GroupsServerHandler(object): remote_attestation=remote_attestation, ) + if not self.hs.is_mine_id(user_id): + yield self.store.add_remote_profile_cache( + user_id, + displayname=user_profile.get("displayname"), + avatar_url=user_profile.get("avatar_url"), + ) + defer.returnValue({ "group_id": group_id, }) |