Fix backend GetEventsSince interface func

This commit is contained in:
nxshock 2019-08-09 23:06:37 +05:00
parent cab885edd8
commit 33bb47bda8
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ type Backend interface {
GetEventByID(id string) rooms.Event GetEventByID(id string) rooms.Event
PutEvent(rooms.Event) error PutEvent(rooms.Event) error
GetRoomByAlias(string) Room GetRoomByAlias(string) Room
GetEventsSince(sinceToken string, limit int) []rooms.Event GetEventsSince(user User, sinceToken string, limit int) []rooms.Event
} }
type Room interface { type Room interface {

View File

@ -201,7 +201,7 @@ func (backend *Backend) PutEvent(event rooms.Event) error {
return nil 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) sinceEventNode := backend.events.GetByKey(sinceToken)
sEvents := backend.events.GetByScoreRange(sinceEventNode.Score(), -1, &sortedset.GetByScoreRangeOptions{ sEvents := backend.events.GetByScoreRange(sinceEventNode.Score(), -1, &sortedset.GetByScoreRangeOptions{
Limit: limit, Limit: limit,
@ -228,7 +228,7 @@ func extractEventsFromNodes(nodes []*sortedset.SortedSetNode) []rooms.Event {
return events 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())) { if internal.InArray(event.RoomID, extractRoomIDsFromModel(user.JoinedRooms())) {
return true return true
} }