From 33bb47bda894034c006f7a928c16b01260203fbb Mon Sep 17 00:00:00 2001 From: nxshock Date: Fri, 9 Aug 2019 23:06:37 +0500 Subject: [PATCH] Fix backend GetEventsSince interface func --- internal/backend.go | 2 +- internal/backends/memory/backend.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/backend.go b/internal/backend.go index 614c0a2..d646409 100644 --- a/internal/backend.go +++ b/internal/backend.go @@ -21,7 +21,7 @@ type Backend interface { GetEventByID(id string) rooms.Event PutEvent(rooms.Event) error GetRoomByAlias(string) Room - GetEventsSince(sinceToken string, limit int) []rooms.Event + GetEventsSince(user User, sinceToken string, limit int) []rooms.Event } type Room interface { diff --git a/internal/backends/memory/backend.go b/internal/backends/memory/backend.go index 6aecca3..04cf4e9 100644 --- a/internal/backends/memory/backend.go +++ b/internal/backends/memory/backend.go @@ -201,7 +201,7 @@ func (backend *Backend) PutEvent(event rooms.Event) error { return nil } -func (backend *Backend) GetEventsSince(user User, sinceToken string, limit int) []rooms.Event { +func (backend *Backend) GetEventsSince(user internal.User, sinceToken string, limit int) []rooms.Event { sinceEventNode := backend.events.GetByKey(sinceToken) sEvents := backend.events.GetByScoreRange(sinceEventNode.Score(), -1, &sortedset.GetByScoreRangeOptions{ Limit: limit, @@ -228,7 +228,7 @@ func extractEventsFromNodes(nodes []*sortedset.SortedSetNode) []rooms.Event { return events } -func isEventRelatedToUser(event rooms.Event, user User) bool { +func isEventRelatedToUser(event rooms.Event, user internal.User) bool { if internal.InArray(event.RoomID, extractRoomIDsFromModel(user.JoinedRooms())) { return true }