diff options
author | Erik Johnston <erik@matrix.org> | 2016-11-03 15:20:54 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-11-03 15:20:54 +0000 |
commit | a005f67eac3107502ba16f8922d116e0e184d055 (patch) | |
tree | b87b063e6891b76e315f4ff6cd2b5492da3f67ff | |
parent | Change API to use properties instead of rows (diff) | |
download | synapse-a005f67eac3107502ba16f8922d116e0e184d055.tar.xz |
Add some comments
-rw-r--r-- | synapse/federation/federation_server.py | 8 | ||||
-rw-r--r-- | synapse/storage/schema/delta/38/profile.py | 14 |
2 files changed, 15 insertions, 7 deletions
diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py index bcfb6e4d8a..9287600cc8 100644 --- a/synapse/federation/federation_server.py +++ b/synapse/federation/federation_server.py @@ -443,6 +443,14 @@ class FederationServer(FederationBase): }) def on_profile_request(self, user_id, persona, key): + """Handle a /profile/ request. Persona and key parameters are optional. + + Args: + user_id (str) + persona (str): Optional if `key` not also set. Returns only info from + the given persona. + key (str): Optional. Returns only the given `key`. + """ if not self.hs.is_mine_id(user_id): raise SynapseError(400, "Not a local user") diff --git a/synapse/storage/schema/delta/38/profile.py b/synapse/storage/schema/delta/38/profile.py index 7802fb1c31..bdd014ffba 100644 --- a/synapse/storage/schema/delta/38/profile.py +++ b/synapse/storage/schema/delta/38/profile.py @@ -24,9 +24,9 @@ CREATE_TABLE = """ CREATE TABLE profiles_extended ( stream_id BIGINT NOT NULL, user_id TEXT NOT NULL, - persona TEXT NOT NULL, - key TEXT NOT NULL, - content TEXT NOT NULL + persona TEXT NOT NULL, -- Which persona this field is in, e.g. `default` + key TEXT NOT NULL, -- the key of this field, e.g. `m.display_name` + content TEXT NOT NULL -- JSON encoded content of the key ); CREATE INDEX profiles_extended_tuple ON profiles_extended( @@ -34,7 +34,7 @@ CREATE INDEX profiles_extended_tuple ON profiles_extended( ); """ -UPDATE_DISPLAY_NAME = """ +POSTGRES_UPDATE_DISPLAY_NAME = """ INSERT INTO profiles_extended (stream_id, user_id, persona, key, content) SELECT 1, @@ -44,7 +44,7 @@ SELECT FROM profiles WHERE displayname IS NOT NULL """ -UPDATE_AVATAR_URL = """ +POSTGRES_UPDATE_AVATAR_URL = """ INSERT INTO profiles_extended (stream_id, user_id, persona, key, content) SELECT 1, @@ -62,8 +62,8 @@ def run_create(cur, database_engine, *args, **kwargs): def run_upgrade(cur, database_engine, config, *args, **kwargs): if isinstance(database_engine, PostgresEngine): - cur.execute(UPDATE_DISPLAY_NAME, (config.server_name,)) - cur.execute(UPDATE_AVATAR_URL, (config.server_name,)) + cur.execute(POSTGRES_UPDATE_DISPLAY_NAME, (config.server_name,)) + cur.execute(POSTGRES_UPDATE_AVATAR_URL, (config.server_name,)) else: cur.execute( "SELECT user_id, displayname FROM profiles WHERE displayname IS NOT NULL" |