From 7444a9ad67de9fc803f707aab939ffaaec0f3cfe Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 14 May 2016 20:28:35 +0300 Subject: [PATCH] Fixed scroll down to reply. Show that bot admins see all messages. Fixed date display when messages were at the same day of different months. Shared contact with author signature height increased. --- Telegram/SourceFiles/history.cpp | 3 +++ Telegram/SourceFiles/history.h | 4 ++-- Telegram/SourceFiles/historywidget.cpp | 10 +++++----- Telegram/SourceFiles/profilewidget.cpp | 18 +++++++++--------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index aedd4dd20..2a61878b0 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -5356,6 +5356,9 @@ void HistoryContact::initDimensions() { if (_userId) { _minh = st::msgFileThumbPadding.top() + st::msgFileThumbSize + st::msgFileThumbPadding.bottom(); + if (_parent->Has()) { + _minh += st::msgDateFont->height - st::msgDateDelta.y(); + } } else { _minh = st::msgFilePadding.top() + st::msgFileSize + st::msgFilePadding.bottom(); } diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 50f1fa41b..35695e4bc 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -1524,8 +1524,8 @@ protected: // to add required bits to the Composer mask // after that always use Has() bool displayDate() const { - if (HistoryItem *prev = previous()) { - return prev->date.date().day() != date.date().day(); + if (auto prev = previous()) { + return prev->date.date() != date.date(); } return true; } diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 0d1a57f35..089dab499 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -3724,11 +3724,6 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re if (_history) { if (_peer->id == peerId && !reload) { - _history->forgetScrollState(); - if (_migrated) { - _migrated->forgetScrollState(); - } - bool wasOnlyImportant = _history->isChannel() ? _history->asChannelHistory()->onlyImportant() : true; bool canShowNow = _history->isReadyFor(showAtMsgId, _fixedInScrollMsgId, _fixedInScrollMsgTop); @@ -3738,6 +3733,11 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re if (!canShowNow) { delayedShowAt(showAtMsgId); } else { + _history->forgetScrollState(); + if (_migrated) { + _migrated->forgetScrollState(); + } + if (_history->isChannel() && wasOnlyImportant != _history->asChannelHistory()->onlyImportant()) { clearAllLoadRequests(); } diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index a5ad1cc3a..adfc156a3 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -1030,15 +1030,6 @@ void ProfileInner::paintEvent(QPaintEvent *e) { if (!data) { data = _participantsData[cnt] = new ParticipantData(); data->name.setText(st::profileListNameFont, user->name, _textNameOptions); - if (user->botInfo) { - if (user->botInfo->readsAllHistory) { - data->online = lang(lng_status_bot_reads_all); - } else { - data->online = lang(lng_status_bot_not_reads_all); - } - } else { - data->online = App::onlineText(user, l_time); - } if (_peerChat) { data->admin = (peerFromUser(_peerChat->creator) == user->id) || (_peerChat->adminsEnabled() && (_peerChat->admins.constFind(user) != _peerChat->admins.cend())); } else if (_peerChannel) { @@ -1046,6 +1037,15 @@ void ProfileInner::paintEvent(QPaintEvent *e) { } else { data->admin = false; } + if (user->botInfo) { + if (user->botInfo->readsAllHistory || data->admin) { + data->online = lang(lng_status_bot_reads_all); + } else { + data->online = lang(lng_status_bot_not_reads_all); + } + } else { + data->online = App::onlineText(user, l_time); + } if (_amCreator) { data->cankick = (user != App::self()); } else if (_peerChat && _peerChat->amAdmin()) {