Skip to content

query/dialogs: iterator fails when a page ends on dialogCommunity #1980

Open

Description

@ikv-ops

What version of gotd are you using?

v0.165.1

Can this issue be reproduced with the latest version?

Yes

What did you do?

Iterated dialogs with telegram/query/dialogs on an account whose dialog list has a dialogCommunity entry. Iteration breaks if a full page ends on that entry.

A clanker found this while working and i confirmed it manually.

In Iterator.apply (telegram/query/dialogs/iter.go:189-192) the next-page offset peer comes from the last dialog of the page:

dlgPeer, ok := dialogPeer(dialogs[len(m.buf)-1])
if !ok {
        return errors.Errorf("get offset peer: dialog %T has no peer", dialogs[len(m.buf)-1])
}

tg.DialogCommunity has no peer. The element loop at line 161 already skips peerless dialogs, but the cursor step doesn't.

What did you expect to see?

All dialogs listed. The community entry is skipped like it is elsewhere.

What did you see instead?

Iteration stops at the community entry with "get offset peer: dialog *tg.DialogCommunity has no peer". Nothing after it gets listed.

What Go version and environment are you using?

$ go version
go version go1.27.3 linux/amd64
go env Output
$ go env
not relevant, logic bug

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions