mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-12 06:33:59 +00:00
Show bot as non-forum if no topics.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user