Skip to content

feat: Implement forum topics support#985

Draft
japananimetime wants to merge 15 commits intoTGX-Android:mainfrom
japananimetime:forum-topics-implementation
Draft

feat: Implement forum topics support#985
japananimetime wants to merge 15 commits intoTGX-Android:mainfrom
japananimetime:forum-topics-implementation

Conversation

@japananimetime
Copy link

Adds complete forum topics functionality:

  • ForumTopicsController: Main topics list with search, create, edit, delete
  • ForumTopicView: Custom view for topic items with icons/avatars
  • ForumTopicTabsController: ViewPager tabs layout for topics
  • Topic message filtering using GetForumTopicHistory
  • Per-topic unread counters, mentions, and reactions
  • Topic notification settings (mute/unmute)
  • Topic typing indicators
  • Topic header in chat view
  • Navigation integration
  • Forum toggle in group settings
  • View as chat/topics toggle
  • Notification separation showing "Chat > Topic"

🤖 Generated with Claude Code

The guide below provides the flow for creating a perfect pull request to the Telegram X Repository. Before submitting your PR, ensure that it complies with the following principles.

Perfect PRs must be:

  • Rational. Explain the changes you've made. Be explicit and describe the changes in a few short, concise sentences.
  • Completed. All changes are properly tested and ready to be merged.
  • Up-To-Date. Your PR is based on the latest commit of the 'main' branch.

When fixing issues, make sure that your PR is:

  • Sufficient. Changes must fix the cause of an issue, not its effects.
  • Separated. Different bug fixes are divided into independent PRs.
  • Linked. If you fix a specific issue, add it to the title and its description to the body.
  • Creating. The fix does not break anything in other interfaces or on specific devices.
  • Consistent. Use the proper design relevant to the issue. If the design is missing, the PR must include at least two screenshots (before and after the changes).

When adding features, expect:

  • Discussion. If you implement a feature that requires a new design for the app, be ready to receive and follow comments or edit suggestions.
  • Dismissal. If the feature design you submitted is below our expectations, if it cripples the UX, or the feature-to-user impact is minor, your PR will be declined. All the features must strictly follow the Telegram X flow – matching the overall quality, stability, and the general style of the app.

Other contributions:

PR types not mentioned above can be considered as well, provided they are rational. For example, optimizations of existing features or the app build time (for this, before/after timing is mandatory). For code refactoring, the code should be clearly improved/simplified/more convenient and is expected to be free of any edge-case bugs.

Good luck and thanks for the contribution!

@japananimetime japananimetime marked this pull request as draft December 18, 2025 16:21
@vkryl vkryl force-pushed the main branch 3 times, most recently from fbec9a8 to 8bb1443 Compare December 21, 2025 23:57
japananimetime and others added 15 commits January 17, 2026 20:17
Adds complete forum topics functionality:
- ForumTopicsController: Main topics list with search, create, edit, delete
- ForumTopicView: Custom view for topic items with icons/avatars
- ForumTopicTabsController: ViewPager tabs layout for topics
- Topic message filtering using GetForumTopicHistory
- Per-topic unread counters, mentions, and reactions
- Topic notification settings (mute/unmute)
- Topic typing indicators
- Topic header in chat view
- Navigation integration
- Forum toggle in group settings
- View as chat/topics toggle
- Notification separation showing "Chat > Topic"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Added break statement after fall-through service message cases in
ContentPreview.getContentPreview() to prevent them from falling through
to the forum topic handlers. This fixes a bug where group photo changes
and other service messages incorrectly showed "Topic created" in the
chat list preview.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add forum layout toggle (tabs vs list) in ProfileController settings
- Fix layout toggle not applying until re-entry (wasForumTabsChanged check)
- Fix visual flash when entering forum tabs by using LoadingController placeholder
- Add Group Info access from tabs mode for admins
- Add permission checks for topic actions UI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Move search loading indicator to ClearButton in search bar (spinner where X button is)
- Fix topic filter dialog icon positioning (18dp left offset instead of 68dp)
- Fix settings popup ripple effect (use ?android:attr/colorControlHighlight for theme-adaptive ripple)
- Remove centered ProgressComponentView in favor of search bar spinner

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…i, search in menu

- ChatHeaderView: Add custom emoji support for forum topic icons
- ForumTopicView: 3-line layout (title, sender, preview) matching chat list
- ForumTopicsController: Add "View as tabs" option, fix draft updates
- ForumTopicTabsController: Add "View as topics" option, move search to menu
- TdlibUi: Fix viewAsTopics check for proper view mode switching
- ShareController: Add forum topics support for sharing
- Add topic list caching in Tdlib

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…h share UI

- Fix unread badge not respecting mute state (issue TGX-Android#2)
  Added forumTopicNeedsMuteIcon() to properly check topic/chat mute hierarchy

- Fix forum badge not updating after reading all topics (issue TGX-Android#4)
  Call updateForumTopicUnreadCount() after fetching fresh topic data

- Fix read receipts not showing in topic messages (issue TGX-Android#9)
  Call manager.updateChatReadOutbox() in onForumTopicUpdated

- Fix notification not opening correct topic (issue TGX-Android#14.2)
  Pass messageThreadId through notification intent chain

- Polish share to topic UI with colored icons (issue TGX-Android#13)
  Show colored circle emoji and pin indicator for each topic

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix forum message link opening: load forum topic when messageTopicId
  is set but forumTopic is null (shows correct topic header)
- Fix WebP sticker crash in ChatHeaderView: check sticker.format instead
  of sticker.fullType to determine ImageFile vs GifFile
- Fix reaction badge icon size: use 16f to match TGChat pattern

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implemented proper TextMediaListener for custom emoji rendering:
- ForumTopicView now implements Text.TextMediaListener
- Added textMediaReceiver for loading custom emoji
- Preview text with custom emoji now renders correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Star reaction icon now respects bounds and scales correctly
- ForumTopicView properly handles custom emoji in preview text

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Forums now skip preview mode on long-press in chat list.
This prevents swipe-up from opening MessagesController instead of
ForumTopicsController.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Implement separate notifications for each forum topic
  - Split notification groups by topic ID for forums
  - Display each topic as separate Android notification
  - Show topic name in notification title: "Chat › Topic"
  - Tap notification opens correct topic

- Fix unread ticks in ForumTopicView
  - Use lastReadInboxMessageId for incoming messages
  - Use lastReadOutboxMessageId for outgoing messages

- Add MessageListener to ForumTopicsController
  - Subscribe to message updates for real-time topic sync
  - Update topic lastMessage when new messages arrive
  - Handle message content changes and deletions
  - Resort topics when messages change

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…navigation

- Replace emoji prefixes with icon-based indicators (mute/lock icons)
- Fix text width calculation to prevent overlap with time/counters
- Fix header margin to prevent title overlap with menu buttons
- Forums with hasForumTabs now always open in tabs view
- Fix "View as chat" navigation to prevent re-opening in tabs mode

Based on fixes from https://github.com/logopek/reX/tree/musicProfile

Co-Authored-By: logopek <logopek@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When sending a message to a forum topic, the topic list wouldn't show
the latest message preview after returning from the topic view.

Root cause: The pending message has topicId=null, causing onNewMessage()
to exit early. When the message succeeds, updateMessageSendSucceeded fires
but ForumTopicsController didn't implement onMessageSendSucceeded().

Fix: Implement onMessageSendSucceeded() to route to onNewMessage() with
the completed message that has topicId properly populated.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add forumTopic() and isForumTopicMuted() helper methods in Tdlib
- Filter notifications from muted forum topics in TdlibNotificationHelper
- Add isFromMutedForumTopic() check in TdlibNotification
- Handle closed topics: block input for non-admins in MessagesController
- Handle forum mode changes in ForumTopicTabsController

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Cherry-picked from logopek/reX: e6d439d
- Save user's preferred forum view (tabs vs topics list)
- Respect saved preference when opening forums
- Store preference per chat in TdlibSettingsManager

Co-Authored-By: shikaatux <logopek@github.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant