mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-29 13:39:06 +00:00
Fix gifts display when can't manage.
This commit is contained in:
parent
22515c8c29
commit
2b16b0fc7c
@ -858,7 +858,9 @@ void InnerWidget::refreshAbout() {
|
|||||||
const auto maybeEmpty = _list->empty();
|
const auto maybeEmpty = _list->empty();
|
||||||
const auto knownEmpty = maybeEmpty && _entries->allLoaded;
|
const auto knownEmpty = maybeEmpty && _entries->allLoaded;
|
||||||
const auto filteredEmpty = knownEmpty && filter.skipsSomething();
|
const auto filteredEmpty = knownEmpty && filter.skipsSomething();
|
||||||
const auto collectionCanAdd = knownEmpty && descriptor.collectionId != 0;
|
const auto collectionCanAdd = knownEmpty
|
||||||
|
&& descriptor.collectionId != 0
|
||||||
|
&& _peer->canManageGifts();
|
||||||
if (filteredEmpty) {
|
if (filteredEmpty) {
|
||||||
auto text = tr::lng_peer_gifts_empty_search(
|
auto text = tr::lng_peer_gifts_empty_search(
|
||||||
tr::now,
|
tr::now,
|
||||||
@ -1087,10 +1089,12 @@ void InnerWidget::refreshCollectionsTabs() {
|
|||||||
.text = std::move(title),
|
.text = std::move(title),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (_peer->canManageGifts()) {
|
||||||
tabs.push_back({
|
tabs.push_back({
|
||||||
.id = u"add"_q,
|
.id = u"add"_q,
|
||||||
.text = { '+' + tr::lng_gift_collection_add(tr::now) },
|
.text = { '+' + tr::lng_gift_collection_add(tr::now) },
|
||||||
});
|
});
|
||||||
|
}
|
||||||
const auto context = Core::TextContext({
|
const auto context = Core::TextContext({
|
||||||
.session = &_window->session(),
|
.session = &_window->session(),
|
||||||
});
|
});
|
||||||
@ -1224,7 +1228,9 @@ void InnerWidget::fillMenu(const Ui::Menu::MenuCallback &addAction) {
|
|||||||
}, &st::menuIconAddToFolder);
|
}, &st::menuIconAddToFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (canManage || !descriptor.collectionId) {
|
||||||
addAction({ .isSeparator = true });
|
addAction({ .isSeparator = true });
|
||||||
|
}
|
||||||
|
|
||||||
addAction(tr::lng_peer_gifts_filter_unlimited(tr::now), [=] {
|
addAction(tr::lng_peer_gifts_filter_unlimited(tr::now), [=] {
|
||||||
change([](Filter &filter) {
|
change([](Filter &filter) {
|
||||||
@ -1339,12 +1345,13 @@ void Widget::refreshBottom() {
|
|||||||
const auto notify = _notifyEnabled.has_value();
|
const auto notify = _notifyEnabled.has_value();
|
||||||
const auto descriptor = _descriptor.current();
|
const auto descriptor = _descriptor.current();
|
||||||
const auto shownId = descriptor.collectionId;
|
const auto shownId = descriptor.collectionId;
|
||||||
|
const auto withButton = shownId && peer()->canManageGifts();
|
||||||
const auto wasBottom = _pinnedToBottom ? _pinnedToBottom->height() : 0;
|
const auto wasBottom = _pinnedToBottom ? _pinnedToBottom->height() : 0;
|
||||||
delete _pinnedToBottom.data();
|
delete _pinnedToBottom.data();
|
||||||
if (!notify && !shownId) {
|
if (!notify && !withButton) {
|
||||||
setScrollBottomSkip(0);
|
setScrollBottomSkip(0);
|
||||||
_hasPinnedToBottom = false;
|
_hasPinnedToBottom = false;
|
||||||
} else if (shownId) {
|
} else if (withButton) {
|
||||||
setupBottomButton(wasBottom);
|
setupBottomButton(wasBottom);
|
||||||
} else {
|
} else {
|
||||||
setupNotifyCheckbox(wasBottom, *_notifyEnabled);
|
setupNotifyCheckbox(wasBottom, *_notifyEnabled);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user