Show bot as non-forum if no topics.

This commit is contained in:
John Preston
2026-05-06 13:46:22 +04:00
parent da0b74a22f
commit be90ed8ef3
6 changed files with 38 additions and 10 deletions
+18 -5
View File
@@ -1700,17 +1700,23 @@ bool PeerData::useSubsectionTabs() const {
return false;
}
bool PeerData::displaySubsectionTabs() const {
if (!useSubsectionTabs()) {
bool PeerData::displayAsForum() const {
if (!isForum()) {
return false;
} else if (const auto bot = asBot()
; bot && !bot->botInfo->userCreatesTopics) {
const auto forum = bot->botInfo->forum();
} else if (Data::IsBotCreatesTopics(this)) {
const auto forum = asBot()->botInfo->forum();
return forum && !forum->topicsList()->empty();
}
return true;
}
bool PeerData::displaySubsectionTabs() const {
if (asBot()) {
return displayAsForum();
}
return useSubsectionTabs();
}
bool PeerData::viewForumAsMessages() const {
if (const auto channel = asChannel()) {
return channel->viewForumAsMessages();
@@ -2251,4 +2257,11 @@ bool IsBotUserCreatesTopics(not_null<PeerData*> peer) {
return false;
}
bool IsBotCreatesTopics(not_null<const PeerData*> peer) {
if (const auto user = peer->asUser()) {
return user->botInfo && !user->botInfo->userCreatesTopics;
}
return false;
}
} // namespace Data