2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Implement topics pin limit box.

This commit is contained in:
John Preston
2022-11-08 18:49:53 +04:00
parent 8a288476b8
commit 248337daf5
4 changed files with 37 additions and 5 deletions

View File

@@ -344,6 +344,7 @@ bool PinnedLimitReached(
// Some old chat, that was converted, maybe is still pinned.
const auto history = thread->asHistory();
if (!history) {
controller->show(Box(ForumPinsLimitBox, thread->asTopic()->forum()));
return true;
}
const auto folder = history->folder();
@@ -380,11 +381,9 @@ void TogglePinnedThread(
return;
}
const auto owner = &thread->owner();
const auto isPinned = !thread->isPinnedDialog(0);
if (const auto history = thread->asHistory()) {
if (isPinned && PinnedLimitReached(controller, history, 0)) {
return;
}
const auto isPinned = !thread->isPinnedDialog(FilterId());
if (isPinned && PinnedLimitReached(controller, thread)) {
return;
}
owner->setChatPinned(thread, FilterId(), isPinned);