summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-12-27 23:58:51 +0000
committerHubert Chathi <hubert@uhoreg.ca>2018-08-12 19:14:31 -0400
commit982edca38026e2bb9085e77b4c25af60c4793f34 (patch)
tree541714dac16ad433825978ed9c1057d940f70578
parentfix typos (diff)
downloadsynapse-982edca38026e2bb9085e77b4c25af60c4793f34.tar.xz
fix flakes
-rw-r--r--synapse/handlers/e2e_room_keys.py4
-rw-r--r--synapse/storage/e2e_room_keys.py6
2 files changed, 6 insertions, 4 deletions
diff --git a/synapse/handlers/e2e_room_keys.py b/synapse/handlers/e2e_room_keys.py
index 6446c3c6c3..fdae69c600 100644
--- a/synapse/handlers/e2e_room_keys.py
+++ b/synapse/handlers/e2e_room_keys.py
@@ -136,7 +136,7 @@ class E2eRoomKeysHandler(object):
         """Upload a given room_key for a given room and session into a given
         version of the backup.  Merges the key with any which might already exist.
 
-        Args: 
+        Args:
             user_id(str): the user whose backup we're setting
             version(str): the version ID of the backup we're updating
             room_id(str): the ID of the room whose keys we're setting
@@ -199,7 +199,7 @@ class E2eRoomKeysHandler(object):
         backup version for the user's keys; previous backups will no longer be
         writeable to.
 
-        Args: 
+        Args:
             user_id(str): the user whose backup version we're creating
             version_info(dict): metadata about the new version being created
 
diff --git a/synapse/storage/e2e_room_keys.py b/synapse/storage/e2e_room_keys.py
index b51faa1204..7ab75070a2 100644
--- a/synapse/storage/e2e_room_keys.py
+++ b/synapse/storage/e2e_room_keys.py
@@ -202,13 +202,15 @@ class EndToEndRoomKeyStore(SQLBaseStore):
                     "SELECT MAX(version) FROM e2e_room_keys_versions WHERE user_id=?",
                     (user_id,)
                 )
-                version = txn.fetchone()[0]
+                this_version = txn.fetchone()[0]
+            else:
+                this_version = version
 
             return self._simple_select_one_txn(
                 table="e2e_room_keys_versions",
                 keyvalues={
                     "user_id": user_id,
-                    "version": version,
+                    "version": this_version,
                 },
                 retcols=(
                     "user_id",