aboutsummaryrefslogtreecommitdiff
path: root/syncapi/storage
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-04-27 11:25:07 +0100
committerGitHub <noreply@github.com>2022-04-27 11:25:07 +0100
commit66b397b3c60c51bba36e4bce858733b2fda26f6a (patch)
tree8479f59b7956d3dcc8ae5f9c872e1e11d7cbf8fa /syncapi/storage
parent6c5c6d73d771e0ea5cc325e4251bcbfc48b7d55e (diff)
Don't create fictitious presence entries (#2381)
* Don't create fictitious presence entries for users that don't have any * Update whitelist, since that test probably shouldn't be passing * Fix panics
Diffstat (limited to 'syncapi/storage')
-rw-r--r--syncapi/storage/postgres/presence_table.go3
-rw-r--r--syncapi/storage/sqlite3/presence_table.go3
2 files changed, 6 insertions, 0 deletions
diff --git a/syncapi/storage/postgres/presence_table.go b/syncapi/storage/postgres/presence_table.go
index 49336c4e..9f1e37f7 100644
--- a/syncapi/storage/postgres/presence_table.go
+++ b/syncapi/storage/postgres/presence_table.go
@@ -127,6 +127,9 @@ func (p *presenceStatements) GetPresenceForUser(
}
stmt := sqlutil.TxStmt(txn, p.selectPresenceForUsersStmt)
err := stmt.QueryRowContext(ctx, userID).Scan(&result.Presence, &result.ClientFields.StatusMsg, &result.LastActiveTS)
+ if err == sql.ErrNoRows {
+ return nil, nil
+ }
result.ClientFields.Presence = result.Presence.String()
return result, err
}
diff --git a/syncapi/storage/sqlite3/presence_table.go b/syncapi/storage/sqlite3/presence_table.go
index 00b16458..177a01bf 100644
--- a/syncapi/storage/sqlite3/presence_table.go
+++ b/syncapi/storage/sqlite3/presence_table.go
@@ -142,6 +142,9 @@ func (p *presenceStatements) GetPresenceForUser(
}
stmt := sqlutil.TxStmt(txn, p.selectPresenceForUsersStmt)
err := stmt.QueryRowContext(ctx, userID).Scan(&result.Presence, &result.ClientFields.StatusMsg, &result.LastActiveTS)
+ if err == sql.ErrNoRows {
+ return nil, nil
+ }
result.ClientFields.Presence = result.Presence.String()
return result, err
}