This commit is contained in:
Simon Ser 2023-10-24 16:54:19 +02:00
parent d85424fe01
commit 8a2a9706f7

View File

@ -89,7 +89,7 @@ func (ms *dbMessageStore) Append(network *database.Network, entity string, msg *
} }
func (ms *dbMessageStore) ListTargets(ctx context.Context, network *database.Network, start, end time.Time, limit int, events bool) ([]ChatHistoryTarget, error) { func (ms *dbMessageStore) ListTargets(ctx context.Context, network *database.Network, start, end time.Time, limit int, events bool) ([]ChatHistoryTarget, error) {
var opts *database.MessageOptions var opts *database.MessageOptions
if start.Before(end) { if start.Before(end) {
opts = &database.MessageOptions{ opts = &database.MessageOptions{
AfterTime: start, AfterTime: start,
@ -103,10 +103,10 @@ func (ms *dbMessageStore) ListTargets(ctx context.Context, network *database.Net
BeforeTime: start, BeforeTime: start,
Limit: limit, Limit: limit,
Events: events, Events: events,
TakeLast: true, TakeLast: true,
} }
} }
l, err := ms.db.ListMessageLastPerTarget(ctx, network.ID, opts); l, err := ms.db.ListMessageLastPerTarget(ctx, network.ID, opts)
if err != nil { if err != nil {
return nil, err return nil, err
} }