aboutsummaryrefslogtreecommitdiff
path: root/roomserver/storage
diff options
context:
space:
mode:
authorDavid Spenler <15622190+DavidSpenler@users.noreply.github.com>2021-07-19 13:33:05 -0400
committerGitHub <noreply@github.com>2021-07-19 18:33:05 +0100
commit8d8fe485b455e3e61b9d894d1d08cb06c99a51d2 (patch)
treea31d0ff64436beb0b94b3d453a10c3a2871fc88e /roomserver/storage
parent5094bc89bf9f7f34fa66be3b40379b0056d7758e (diff)
Fix failing ban tests (#1884)
* Add room membership and powerlevel checks for func SendBan * Added non-error return to func GetStateEvent when no state events with the specified state key are found * Add passing tests to whitelist * Fixed formatting * Update roomserver/storage/shared/storage.go Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com> Co-authored-by: kegsay <kegan@matrix.org> Co-authored-by: kegsay <kegsay@gmail.com>
Diffstat (limited to 'roomserver/storage')
-rw-r--r--roomserver/storage/shared/storage.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go
index 9d9434cb..8e787851 100644
--- a/roomserver/storage/shared/storage.go
+++ b/roomserver/storage/shared/storage.go
@@ -866,6 +866,10 @@ func (d *Database) GetStateEvent(ctx context.Context, roomID, evType, stateKey s
return nil, err
}
stateKeyNID, err := d.EventStateKeysTable.SelectEventStateKeyNID(ctx, nil, stateKey)
+ if err == sql.ErrNoRows {
+ // No rooms have a state event with this state key, otherwise we'd have an state key NID
+ return nil, nil
+ }
if err != nil {
return nil, err
}