2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 07:25:46 +00:00

Alpha 1.0.10: unpinning converted chat on demand.

If we want to pin a chat and we have reached the limit we now check
for a deactivated (converted to supergroup) chat that is pinned and
is not in the chats list and just silently unpin it if it is found.

Also possible UB fix for a waveform encoding and decoding.
This commit is contained in:
John Preston
2017-02-16 19:47:50 +03:00
parent 8d354382a4
commit 7adfe93a8d
12 changed files with 103 additions and 32 deletions

View File

@@ -109,15 +109,27 @@ void paintRow(Painter &p, const RippleRow *row, History *history, HistoryItem *i
p.restoreTextPalette();
}
} else if (!item) {
auto availableWidth = namewidth;
if (history->isPinnedDialog()) {
auto &icon = (active ? st::dialogsPinnedIconActive : (selected ? st::dialogsPinnedIconOver : st::dialogsPinnedIcon));
icon.paint(p, fullWidth - st::dialogsPadding.x() - icon.width(), texttop, fullWidth);
availableWidth -= icon.width() + st::dialogsUnreadPadding;
}
auto &color = active ? st::dialogsTextFgServiceActive : (selected ? st::dialogsTextFgServiceOver : st::dialogsTextFgService);
p.setFont(st::dialogsTextFont);
if (!history->paintSendAction(p, nameleft, texttop, namewidth, fullWidth, color, ms)) {
if (!history->paintSendAction(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) {
// Empty history
}
} else if (!item->isEmpty()) {
paintRowDate(p, date, rectForName, active, selected);
paintItemCallback(nameleft, namewidth, item);
} else if (history->isPinnedDialog()) {
auto availableWidth = namewidth;
auto &icon = (active ? st::dialogsPinnedIconActive : (selected ? st::dialogsPinnedIconOver : st::dialogsPinnedIcon));
icon.paint(p, fullWidth - st::dialogsPadding.x() - icon.width(), texttop, fullWidth);
availableWidth -= icon.width() + st::dialogsUnreadPadding;
}
auto sendStateIcon = ([draft, item, active, selected]() -> const style::icon* {
if (draft) {