Skip to content

Joined communities aren't cached: the dialog pass and chats list --fresh skip them #58

Closed

Description

@neoromantic

Found while fixing #45 (#55). Since #55 the chat cache stores a Telegram community (a collection of linked chats) as type community with its access hash, but nothing caches a joined community, so tg chats list --type community finds none:

  • The daemon's dialog pass and tg chats list --fresh go through mtcute's Dialog.parseTlDialogs, which keeps only dialog. Telegram lists a joined community as dialogCommunity, so it is dropped.
  • Live updates cache the chat a message belongs to, and a message's peer is never a community (Peer is only user, chat or channel).
  • tg chats get --id @username resolves by username, and a community has none.

Fix: in the dialog pass and in tg chats list --fresh, also fetch joined communities with mtcute's client.getJoinedCommunities() (communities.getJoinedCommunities) and cache each through rawChatToCacheInput. While there, check live what messages.getHistory returns for a community: dialogCommunity has no top message and communityFull lists linked peers, so a community may have no messages of its own, and tg chats sync <community> should say so instead of queueing jobs that fail. Its linked chats are ordinary supergroups and channels and already sync as such.

Done when a joined community shows up in tg chats list --type community after a daemon start and after tg chats list --fresh, with its access hash, unit tests cover both paths, and the docs no longer say communities aren't cached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions