aboutsummaryrefslogtreecommitdiff
path: root/syncapi/storage/shared
diff options
context:
space:
mode:
authorS7evinK <2353100+S7evinK@users.noreply.github.com>2022-02-21 17:12:22 +0100
committerGitHub <noreply@github.com>2022-02-21 17:12:22 +0100
commitcf525d1f619cc65df244c20ec0f220ace22ae2bd (patch)
tree40e72b7e7da95956892d45e1613ad7eae206d147 /syncapi/storage/shared
parent280e9b19a195e3ce19f0fa5bc0e94bb09e397a23 (diff)
Implement `/context` (#2207)
* Add QueryEventsAfter * Add /context * Make all tests pass on sqlite * Add queries to get the events for /context requests * Move /context to the syncapi * Revert "Add QueryEventsAfter" This reverts commit 440a771d10632622e8c65d35fe90f0804bc98862. * Simplify getting the required events * Apply RoomEventFilter when getting events * Add passing tests * Remove logging * Remove unused SQL statements Update comments & add TODO
Diffstat (limited to 'syncapi/storage/shared')
-rw-r--r--syncapi/storage/shared/syncserver.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/syncapi/storage/shared/syncserver.go b/syncapi/storage/shared/syncserver.go
index e6c68183..819851b3 100644
--- a/syncapi/storage/shared/syncserver.go
+++ b/syncapi/storage/shared/syncserver.go
@@ -955,3 +955,14 @@ func (d *Database) GetRoomReceipts(ctx context.Context, roomIDs []string, stream
_, receipts, err := d.Receipts.SelectRoomReceiptsAfter(ctx, roomIDs, streamPos)
return receipts, err
}
+
+func (s *Database) SelectContextEvent(ctx context.Context, roomID, eventID string) (int, gomatrixserverlib.HeaderedEvent, error) {
+ return s.OutputEvents.SelectContextEvent(ctx, nil, roomID, eventID)
+}
+
+func (s *Database) SelectContextBeforeEvent(ctx context.Context, id int, roomID string, filter *gomatrixserverlib.RoomEventFilter) ([]*gomatrixserverlib.HeaderedEvent, error) {
+ return s.OutputEvents.SelectContextBeforeEvent(ctx, nil, id, roomID, filter)
+}
+func (s *Database) SelectContextAfterEvent(ctx context.Context, id int, roomID string, filter *gomatrixserverlib.RoomEventFilter) (int, []*gomatrixserverlib.HeaderedEvent, error) {
+ return s.OutputEvents.SelectContextAfterEvent(ctx, nil, id, roomID, filter)
+}