Fix iOS admin log initial bounds

This commit is contained in:
HSgram 2026-07-02 19:45:30 +08:00
parent 44e8cde27f
commit e90dbdf5a3
2 changed files with 15 additions and 0 deletions

View file

@ -743,6 +743,9 @@ func (s *Service) ListAdminLog(ctx context.Context, userID int64, req domain.Cha
if req.UserID == 0 {
req.UserID = userID
}
if req.MinID < 0 {
req.MinID = 0
}
if req.UserID != userID || req.ChannelID == 0 || req.MaxID < 0 || req.MinID < 0 {
return domain.ChannelAdminLogResult{}, domain.ErrChannelInvalid
}

View file

@ -2128,6 +2128,18 @@ func TestChannelAdminTitlePinAndInvite(t *testing.T) {
if err != nil {
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{}
for _, event := range logs.Events {
seen[event.Type] = true