mirror of
https://github.com/signaller-matrix/signaller.git
synced 2024-11-09 12:11:03 +00:00
Fix backend GetEventsSince interface func
This commit is contained in:
parent
cab885edd8
commit
33bb47bda8
@ -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 {
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user