Fix iOS admin log initial bounds
This commit is contained in:
parent
44e8cde27f
commit
e90dbdf5a3
2 changed files with 15 additions and 0 deletions
|
|
@ -743,6 +743,9 @@ func (s *Service) ListAdminLog(ctx context.Context, userID int64, req domain.Cha
|
||||||
if req.UserID == 0 {
|
if req.UserID == 0 {
|
||||||
req.UserID = userID
|
req.UserID = userID
|
||||||
}
|
}
|
||||||
|
if req.MinID < 0 {
|
||||||
|
req.MinID = 0
|
||||||
|
}
|
||||||
if req.UserID != userID || req.ChannelID == 0 || req.MaxID < 0 || req.MinID < 0 {
|
if req.UserID != userID || req.ChannelID == 0 || req.MaxID < 0 || req.MinID < 0 {
|
||||||
return domain.ChannelAdminLogResult{}, domain.ErrChannelInvalid
|
return domain.ChannelAdminLogResult{}, domain.ErrChannelInvalid
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2128,6 +2128,18 @@ func TestChannelAdminTitlePinAndInvite(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("ListAdminLog: %v", err)
|
t.Fatalf("ListAdminLog: %v", err)
|
||||||
}
|
}
|
||||||
|
iosInitialLogs, err := service.ListAdminLog(ctx, 1001, domain.ChannelAdminLogRequest{
|
||||||
|
ChannelID: created.Channel.ID,
|
||||||
|
MaxID: 1<<63 - 1,
|
||||||
|
MinID: -1 << 63,
|
||||||
|
Limit: 20,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("ListAdminLog iOS initial bounds: %v", err)
|
||||||
|
}
|
||||||
|
if len(iosInitialLogs.Events) == 0 {
|
||||||
|
t.Fatalf("ListAdminLog iOS initial bounds returned no events, want admin history")
|
||||||
|
}
|
||||||
seen := map[domain.ChannelAdminLogEventType]bool{}
|
seen := map[domain.ChannelAdminLogEventType]bool{}
|
||||||
for _, event := range logs.Events {
|
for _, event := range logs.Events {
|
||||||
seen[event.Type] = true
|
seen[event.Type] = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue