Commit graph

176 commits

Author SHA1 Message Date
11dd7660c0 botapi: getChatMemberCount, getChatMember, and a fuller getChat
- getChatMemberCount: channel/supergroup participant count (numeric chat_id).
- getChatMember: resolves a member via GetParticipant, projected to a Bot API
  ChatMember (creator/administrator/restricted/member/left/kicked with the
  matching rights); a user simply not in an accessible chat returns "left".
- getChat now uses the full channel view and adds permissions (from the default
  restrictions), slow_mode_delay, linked_chat_id and pinned_message.

Channel-only methods reject user chat_ids; private chats the bot cannot access
return CHAT_NOT_FOUND.
2026-09-09 16:26:33 +01:00
d022521d67 botapi: implement getChat
Adds the getChat method to the HTTP Bot API gateway. Numeric chat_id only (no
@username). Resolution goes through the shared peer resolvers:

- user: ByID; unknown -> CHAT_NOT_FOUND
- channel/supergroup: ResolveChannel, so a public one resolves even when the bot
  is not a member (projected as a preview); a private one the bot cannot access
  -> CHAT_NOT_FOUND, a banned bot likewise

The Chat projection returns id (bot-api encoded), type ("channel" for a
broadcast, "supergroup" for a megagroup, "private" for a user), title, username,
first/last name, description, is_forum, and the scam/fake/verified flags.
2026-09-09 16:14:49 +01:00
f6d7ef4652 forum: let non-members preview topic replies in a public channel
ListChannelReplies used getChannelForMemberOrLinkedGuest, so messages.getReplies
was member-only. ListChannelHistory (flat history) uses getChannelForViewer and
already allows a public channel's non-members to preview it. The mismatch meant
that on a public forum you could preview the flat history but not the topics -
and after leaving, tdesktop's topic view got CHANNEL_PRIVATE and sat on
"Loading..." forever instead of rendering a preview.

Switch the primary channel lookup in ListChannelReplies (both stores) to the
viewer-scope path. Private channels still return CHANNEL_PRIVATE to non-members;
the broadcast comment-thread lookup is unchanged.
2026-09-09 14:43:59 +01:00
a9fbb1f80d forum: project the forum's own channel with member state in getForumTopics
messages.getForumTopics returned every chat via tgChannels -> tgChannelChatMin,
so the forum's own channel came back as a min object with left unset. A client
with no other object for that peer (a fresh account browsing a public forum by
username) then rendered the forum as already joined: topic list visible, no
Join button, but no messages.

Render the primary channel with tgChannelChatForView so a non-member preview
carries left=true; keep the other referenced channels as min.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-09 13:53:20 +01:00
69d64f3d80 welcome message: point updates-channel mention at @ziodotsh
Rename the official updates channel mention from @zio to @ziodotsh in the
welcome message template and update the affected send-message test.
2026-09-09 13:49:07 +01:00
2419f47236 channels: drop stale membership caches on join/leave
After channels.leaveChannel, a client that polls channels.getFullChannel kept
receiving a projection that still showed it as an active member (left=false)
until the per-(viewer,channel) RPC projection cache and the store-level member
cache lapsed on their own or the async read-model NOTIFY landed. The client
therefore kept an open compose box while every send was already rejected with
CHANNEL_PRIVATE - most visible on public forum supergroups, where getFullChannel
keeps succeeding via the preview path instead of tearing the chat down.

Every other membership-mutating path already busts these caches synchronously;
join/leave/invite/request-approval did not. Add:

- store: invalidateChannelMembershipCaches (row + member + dialog caches),
  called post-commit from JoinChannel, LeaveChannel, ImportInvite,
  InviteToChannel.
- rpc: invalidateChannelMembershipProjection (channelFullProjectionCache pair),
  called from the join/leave/invite/hide-requests handlers for every user whose
  membership changed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-09 13:28:50 +01:00
41f65bf0fc forum: fix reply_to_top_id for replies inside a forum
resolveChannelReply applied discussion-thread logic (reply_to_top_id =
the replied-to message's own id) to forum replies. Replying to a General
message produced reply_to_top_id = <that id>, a topic no client can
resolve: the reply vanished from every topic view and reply-jump on
strict clients said "message doesn't exist".

Forum replies now inherit the target's topic via domain.ForumReplyTopicID
(target's topic, or its own id if it's a topic-create, else General), and
General (topic 1) is accepted as a valid virtual topic everywhere, so
sends carrying top_msg_id: 1 are no longer rejected. Non-forum discussion
threads are unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-09 11:15:56 +01:00
443ca300b9 forum: let non-members browse a public forum's topic list
ListForumTopics / GetForumTopicsByID / GeneralForumTopic gated on
membership while channel history uses the public-preview path, so a
public forum's topics (General included) were invisible until you joined.
Switch them to getChannelForViewer / channelForViewerLocked; private
forums and write paths keep the membership gate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-09 11:15:56 +01:00
f26468ef6d media: never project zero image/video dimensions (crashes Telegram Desktop on reactions) 2026-09-08 16:29:37 +01:00
f8aefb7fd5 payments: stub getStarGifts / getSavedStarGifts to stop tdesktop 500 retry storm 2026-09-08 16:29:37 +01:00
80e99e8781 Don't 500 on channel sends with an unresolvable @mention
A channel post containing an @token that is not a syntactically valid
username (too short, leading digit, etc.) made messages.sendMessage return
500 INTERNAL_SERVER_ERROR: mentionedUserIDsFromMessage turned every
ResolveUsername error into internalErr().

Skip tokens that fail with ErrUsernameInvalid / ErrUsernameNotOccupied
instead, matching real Telegram (the message sends, the client renders the
mention and only fails to open it on tap). Only unexpected storage errors
still abort. Same fix applied to the bot send path.
2026-09-08 11:42:03 +01:00
onysd
5e18bd3830 fix for gif and emojies categories 2026-08-24 22:42:40 +03:00
onysd
ff1d5ae361 fix 2026-08-07 10:13:42 +03:00
onysd
354128c106 added full gifts support 2026-08-07 10:13:11 +03:00
onysd
21d8e91756 removed all "paid" features - no more stars, gifts, or grams 2026-08-07 01:50:10 +03:00
onysd
03f10b66ee s3 support 2026-08-04 23:09:11 +03:00
onysd
ac6a50c5ff Merge remote-tracking branch 'upstream/main' into merge-gramsrv-9106877 2026-08-03 23:29:20 +03:00
iamxvbaba
656b01dba7 perf(rpc): sync eliminate upload preflight allocations 2026-08-03 17:33:49 +08:00
iamxvbaba
e70bb0f167 sync: # file upload improve 2026-08-03 17:33:49 +08:00
iamxvbaba
9041abd3d3 fix: sync correct collectible username projection 2026-08-02 19:32:18 +08:00
iamxvbaba
8356989e01 fix: sync streamline self username cache convergence 2026-08-02 19:32:18 +08:00
iamxvbaba
8bc1560c16 fix: sync drive TDLib username cache convergence 2026-08-02 19:32:17 +08:00
iamxvbaba
f67e87689c fix: sync refresh complete self profile on session ready 2026-08-02 19:32:17 +08:00
iamxvbaba
2512eab51d fix: sync harden auth, privacy, and PTS state 2026-08-02 14:12:04 +08:00
iamxvbaba
141f2f20c4 feat(loadtest): sync add real 500-session capacity harness 2026-08-02 12:05:00 +08:00
iamxvbaba
7e0f9d1e62 feat(stars): sync implement unified purchase flow 2026-08-02 01:51:03 +08:00
iamxvbaba
c854fc7b94 feat: sync implement Stars friend gift packages 2026-08-02 01:51:02 +08:00
iamxvbaba
3a123f38db fix(stars): sync filter transaction history by direction 2026-08-02 01:51:02 +08:00
iamxvbaba
94f3843d23 fix(appearance): sync close Android theme wallpaper fallback
Public projection of telesrv 2c8b7cb4c20692d00017bd84f68dd11d7915ec33 with neutral appearance seed naming. Covers gramsrv#29.
2026-08-01 15:22:31 +08:00
onysd
d7fd75e487 fixes for loading issues 2026-07-31 22:33:08 +03:00
iamxvbaba
c9371c6048 fix(messages): sync recognize configured app link entities 2026-08-01 00:12:02 +08:00
iamxvbaba
35d3908660 fix: sync harden star gift upgrade projections 2026-08-01 00:12:01 +08:00
onysd
84063d75fc better fix 2026-07-31 16:57:57 +03:00
iamxvbaba
ee74d941bb fix(rpc): sync preserve complete username projections 2026-07-31 20:42:25 +08:00
onysd
58ca71f0b7 fix for security bug 2026-07-31 15:29:04 +03:00
iamxvbaba
e756b0f9f9 fix(mtprotoedge): sync admit nested gzip RPC envelopes 2026-07-31 15:35:10 +08:00
iamxvbaba
0d917ef87e fix: sync Android default theme installs 2026-07-30 20:13:22 +08:00
iamxvbaba
80c36a8ab4 fix: sync authorize monoforum message views 2026-07-30 20:09:47 +08:00
iamxvbaba
fd47dd765a fix(channels): sync monoforum suggested forwards and reactions 2026-07-30 16:05:34 +08:00
iamxvbaba
3fa0c6f1e4 fix(rpc): sync verification icon envelope coverage
Follow up gramsrv#27 with the remaining peer-bearing messages.Messages boundaries and route-level wire regression coverage from the telesrv canonical implementation.

Origin-PR: gramsrv#27
Origin-Head: f0bd6c9699
Origin-Merge: 7713847b2a
Canonical: f1ba406015a2d5e37802b963757a5cac8ee3eb0e

Co-authored-by: epilepticseizureee <business.egor.sg@gmail.com>
2026-07-30 14:06:39 +08:00
epilepticseizureee
f0bd6c9699 fix(rpc): preserve verification icons in message envelopes 2026-07-29 23:38:17 +03:00
iamxvbaba
cec4361d8b fix(rpc): sync peer verification badge persistence 2026-07-29 20:16:30 +08:00
iamxvbaba
5e1f867b2d fix(channels): sync stop replaying clear-history updates 2026-07-29 16:19:04 +08:00
iamxvbaba
73cf6a8184 fix(channels): sync preserve locally cleared dialogs 2026-07-29 16:19:04 +08:00
iamxvbaba
e22fac1c3f fix(messages): sync preserve private dialogs after clearing history 2026-07-29 13:51:02 +08:00
iamxvbaba
3926db7762 fix(rich-message): sync preserve referenced media for web clients 2026-07-28 18:56:37 +08:00
iamxvbaba
5156b17c1b fix(usernames): sync index active collectible aliases 2026-07-28 16:22:34 +08:00
iamxvbaba
2f995f607a fix: sync serve client sticker categories 2026-07-28 16:22:34 +08:00
iamxvbaba
a989e118d7 fix: sync preserve iOS theme accent visibility 2026-07-28 16:22:34 +08:00
iamxvbaba
209a0d279b fix: sync harden channel reads and suggested approvals 2026-07-28 16:22:33 +08:00