Merge pull request #2118 from matrix-org/erikj/no_devices

Fix getting latest device IP for user with no devices
pull/2127/head
Erik Johnston 2017-04-12 10:14:32 +01:00 committed by GitHub
commit 7b41013102
1 changed files with 3 additions and 0 deletions

View File

@ -120,6 +120,9 @@ class ClientIpStore(background_updates.BackgroundUpdateStore):
where_clauses.append("(user_id = ? AND device_id = ?)")
bindings.extend((user_id, device_id))
if not where_clauses:
return []
inner_select = (
"SELECT MAX(last_seen) mls, user_id, device_id FROM user_ips "
"WHERE %(where)s "