aboutsummaryrefslogtreecommitdiff
path: root/roomserver/storage
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-03-09 10:42:24 +0000
committerGitHub <noreply@github.com>2022-03-09 10:42:24 +0000
commit089d16812c8a94b39592d42d7c15edc2d6746f1d (patch)
tree8e49369b9922faeba235f50bf813caa1c61198b7 /roomserver/storage
parent030b99563608bd86cec90793882168a410cf0edb (diff)
Fix `GET /directory/list/room/{roomID}` (#2262)
* Let's try to work out why this endpoint lies * Try that again * Fix `QueryPublishedRooms` * Remove logging * Remove unnecessary change * Remove unnecessary change
Diffstat (limited to 'roomserver/storage')
-rw-r--r--roomserver/storage/interface.go2
-rw-r--r--roomserver/storage/shared/storage.go4
2 files changed, 6 insertions, 0 deletions
diff --git a/roomserver/storage/interface.go b/roomserver/storage/interface.go
index a2b22b40..a98fda07 100644
--- a/roomserver/storage/interface.go
+++ b/roomserver/storage/interface.go
@@ -139,6 +139,8 @@ type Database interface {
PublishRoom(ctx context.Context, roomID string, publish bool) error
// Returns a list of room IDs for rooms which are published.
GetPublishedRooms(ctx context.Context) ([]string, error)
+ // Returns whether a given room is published or not.
+ GetPublishedRoom(ctx context.Context, roomID string) (bool, error)
// TODO: factor out - from currentstateserver
diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go
index dd49f35c..68fd3867 100644
--- a/roomserver/storage/shared/storage.go
+++ b/roomserver/storage/shared/storage.go
@@ -669,6 +669,10 @@ func (d *Database) PublishRoom(ctx context.Context, roomID string, publish bool)
})
}
+func (d *Database) GetPublishedRoom(ctx context.Context, roomID string) (bool, error) {
+ return d.PublishedTable.SelectPublishedFromRoomID(ctx, nil, roomID)
+}
+
func (d *Database) GetPublishedRooms(ctx context.Context) ([]string, error) {
return d.PublishedTable.SelectAllPublishedRooms(ctx, nil, true)
}