mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-10 13:43:54 +00:00
Show plain topics list for forum opened in community.
This commit is contained in:
@@ -616,7 +616,7 @@ bool InnerWidget::updateEntryHeight(not_null<Entry*> entry) {
|
||||
top += result.row->height();
|
||||
}
|
||||
}
|
||||
if (_openedCommunity) {
|
||||
if (communityModeShown()) {
|
||||
if (const auto history = entry->asHistory()) {
|
||||
const auto recount = [&](CommunityRowsView &view) {
|
||||
if (view.contains(history)) {
|
||||
@@ -637,7 +637,7 @@ void InnerWidget::setNarrowRatio(float64 narrowRatio) {
|
||||
_geometryInited = true;
|
||||
_narrowRatio = narrowRatio;
|
||||
auto changed = _shownList->updateHeights(_narrowRatio);
|
||||
if (_openedCommunity) {
|
||||
if (communityModeShown()) {
|
||||
const auto recount = [&](CommunityRowsView &view) {
|
||||
const auto was = view.height();
|
||||
view.recountHeights(_narrowRatio);
|
||||
@@ -709,7 +709,7 @@ int InnerWidget::dialogsOffset() const {
|
||||
return collapsedRowsOffset()
|
||||
+ (_collapsedRows.size() * st::dialogsImportantBarHeight)
|
||||
- skipTopHeight()
|
||||
+ ((_openedCommunity && !_shownList->empty())
|
||||
+ ((communityModeShown() && !_shownList->empty())
|
||||
? st::searchedBarHeight
|
||||
: 0);
|
||||
}
|
||||
@@ -832,6 +832,10 @@ int InnerWidget::communityRowAbsoluteTop(int index) const {
|
||||
+ _communityViewable.rowTop(index);
|
||||
}
|
||||
|
||||
bool InnerWidget::communityModeShown() const {
|
||||
return _openedCommunity && !_openedForum;
|
||||
}
|
||||
|
||||
void InnerWidget::changeOpenedFolder(Data::Folder *folder) {
|
||||
Expects(!folder || !_savedSublists);
|
||||
|
||||
@@ -870,6 +874,9 @@ void InnerWidget::changeOpenedForum(Data::Forum *forum) {
|
||||
_openedForum = forum;
|
||||
_st = forum ? &st::forumTopicRow : &st::defaultDialogRow;
|
||||
refreshShownList();
|
||||
if (!forum && _openedCommunity) {
|
||||
rebuildCommunitySections();
|
||||
}
|
||||
|
||||
_openedForumLifetime.destroy();
|
||||
if (forum) {
|
||||
@@ -895,7 +902,7 @@ void InnerWidget::rebuildCommunitySections() {
|
||||
_communityViewable.clear();
|
||||
_communitySelected = -1;
|
||||
setCommunityPressed(-1);
|
||||
if (!_openedCommunity) {
|
||||
if (!communityModeShown()) {
|
||||
return;
|
||||
}
|
||||
const auto owner = &session().data();
|
||||
@@ -1012,14 +1019,14 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||
.topicJumpCache = _topicJumpCache.get(),
|
||||
.folder = _openedFolder,
|
||||
.forum = _openedForum,
|
||||
.community = _openedCommunity,
|
||||
.community = communityModeShown() ? _openedCommunity : nullptr,
|
||||
.currentBg = currentBg(),
|
||||
.filter = _filterId,
|
||||
.now = ms,
|
||||
.width = fullWidth,
|
||||
.paused = videoPaused,
|
||||
.narrow = (fullWidth < st::columnMinimalWidthLeft / 2),
|
||||
.insideCommunity = (_openedCommunity != nullptr),
|
||||
.insideCommunity = communityModeShown(),
|
||||
};
|
||||
const auto fillGuard = gsl::finally([&] {
|
||||
// We translate painter down, but it'll be cropped below rect.
|
||||
@@ -1216,14 +1223,14 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
};
|
||||
if (_state == WidgetState::Default) {
|
||||
if (_openedCommunity) {
|
||||
if (communityModeShown()) {
|
||||
p.save();
|
||||
}
|
||||
const auto collapsedSkip = collapsedRowsOffset();
|
||||
p.translate(0, collapsedSkip);
|
||||
paintCollapsedRows(p, r.translated(0, -collapsedSkip));
|
||||
|
||||
if (_openedCommunity && !_shownList->empty()) {
|
||||
if (communityModeShown() && !_shownList->empty()) {
|
||||
p.translate(0, st::searchedBarHeight);
|
||||
}
|
||||
|
||||
@@ -1309,7 +1316,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||
} else {
|
||||
p.fillRect(dialogsClip, currentBg());
|
||||
}
|
||||
if (_openedCommunity) {
|
||||
if (communityModeShown()) {
|
||||
p.restore();
|
||||
const auto paintBar = [&](const QString &text) {
|
||||
p.fillRect(
|
||||
@@ -2213,7 +2220,7 @@ void InnerWidget::selectByMouse(QPoint globalPosition) {
|
||||
const auto selectedRightButton = selected
|
||||
&& lookupIsInBotAppButton(selected, QPoint(local.x(), mappedY));
|
||||
auto communitySelected = -1;
|
||||
if (_openedCommunity && !selected && collapsedSelected < 0) {
|
||||
if (communityModeShown() && !selected && collapsedSelected < 0) {
|
||||
const auto pick = [&](
|
||||
int sectionTop,
|
||||
int flatBase,
|
||||
@@ -3258,7 +3265,7 @@ void InnerWidget::handleChatListEntryRefreshes() {
|
||||
return (topic->forum() == _openedForum);
|
||||
} else if (const auto sublist = event.key.sublist()) {
|
||||
return sublist->parent() == _savedSublists;
|
||||
} else if (_openedCommunity) {
|
||||
} else if (communityModeShown()) {
|
||||
const auto history = event.key.history();
|
||||
return history
|
||||
&& (history->communityListInfo() == _openedCommunity);
|
||||
@@ -3286,7 +3293,7 @@ void InnerWidget::handleChatListEntryRefreshes() {
|
||||
? (key.topic()->forum() == _openedForum)
|
||||
: key.sublist()
|
||||
? (key.sublist()->parent() == _savedSublists)
|
||||
: _openedCommunity
|
||||
: communityModeShown()
|
||||
? (entry->asHistory()
|
||||
&& entry->asHistory()->communityListInfo()
|
||||
== _openedCommunity)
|
||||
@@ -3324,7 +3331,7 @@ void InnerWidget::handleChatListEntryRefreshes() {
|
||||
}
|
||||
_updated.fire({});
|
||||
}
|
||||
if (_openedCommunity) {
|
||||
if (communityModeShown()) {
|
||||
rebuildCommunitySections();
|
||||
}
|
||||
refresh();
|
||||
@@ -4769,7 +4776,7 @@ void InnerWidget::refresh(bool toTop) {
|
||||
}
|
||||
auto h = 0;
|
||||
if (_state == WidgetState::Default) {
|
||||
if (_openedCommunity) {
|
||||
if (communityModeShown()) {
|
||||
const auto requestableShown = _communityRequestableList
|
||||
&& (_communityRequestableCount > 0);
|
||||
if (_shownList->empty()
|
||||
@@ -5009,7 +5016,7 @@ void InnerWidget::updateCommunityRequestableGeometry() {
|
||||
if (!_communityRequestableList) {
|
||||
return;
|
||||
}
|
||||
const auto shown = _openedCommunity
|
||||
const auto shown = communityModeShown()
|
||||
&& (_state == WidgetState::Default)
|
||||
&& (_communityRequestableCount > 0);
|
||||
_communityRequestableList->setVisible(shown);
|
||||
@@ -5063,7 +5070,7 @@ bool InnerWidget::archiveSearchActive() const {
|
||||
}
|
||||
|
||||
bool InnerWidget::communitySearchActive() const {
|
||||
return (_openedCommunity || _searchState.community)
|
||||
return (communityModeShown() || _searchState.community)
|
||||
&& ((_searchState.tab == ChatSearchTab::ThisCommunity)
|
||||
|| !QStringView(_searchState.query).trimmed().isEmpty());
|
||||
}
|
||||
@@ -5136,7 +5143,7 @@ void InnerWidget::updateSearchIn() {
|
||||
: nullptr;
|
||||
const auto communityChannel = _searchState.community
|
||||
? _searchState.community
|
||||
: _openedCommunity
|
||||
: communityModeShown()
|
||||
? _openedCommunity->channel().get()
|
||||
: nullptr;
|
||||
const auto communityIcon = (communityChannel && !_searchState.inChat)
|
||||
|
||||
Reference in New Issue
Block a user