diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index fa27886cc0..5978848629 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -732,6 +732,8 @@ void HistoryMessage::refreshSentMedia(const MTPMessageMedia *media) { refreshMedia(media); if (wasGrouped) { Auth().data().groups().refreshMessage(this); + } else { + Auth().data().requestItemViewRefresh(this); } } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index f0f151f16e..e80a1cb0b4 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2235,7 +2235,9 @@ void HistoryWidget::destroyUnreadBar() { if (_migrated) _migrated->destroyUnreadBar(); } -void HistoryWidget::newUnreadMsg(History *history, HistoryItem *item) { +void HistoryWidget::newUnreadMsg( + not_null history, + not_null item) { if (_history == history) { // If we get here in non-resized state we can't rely on results of // doWeReadServerHistory() and mark chat as read. @@ -2256,7 +2258,11 @@ void HistoryWidget::newUnreadMsg(History *history, HistoryItem *item) { } } Auth().notifications().schedule(history, item); - history->changeUnreadCount(1); + if (history->unreadCountKnown()) { + history->changeUnreadCount(1); + } else { + Auth().api().requestDialogEntry(history); + } } void HistoryWidget::historyToDown(History *history) { diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 3c62c77098..1ffef07f37 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -201,7 +201,9 @@ public: void firstLoadMessages(); void delayedShowAt(MsgId showAtMsgId); - void newUnreadMsg(History *history, HistoryItem *item); + void newUnreadMsg( + not_null history, + not_null item); void historyToDown(History *history); void unreadCountChanged(not_null history); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 5f5fdf3646..598be81822 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2684,7 +2684,9 @@ void MainWidget::dialogsToUp() { _dialogs->dialogsToUp(); } -void MainWidget::newUnreadMsg(History *history, HistoryItem *item) { +void MainWidget::newUnreadMsg( + not_null history, + not_null item) { _history->newUnreadMsg(history, item); } diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 7d5df7e359..040672f9bc 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -125,7 +125,9 @@ public: const MTPUpdates &updates); void historyToDown(History *hist); void dialogsToUp(); - void newUnreadMsg(History *history, HistoryItem *item); + void newUnreadMsg( + not_null history, + not_null item); void markActiveHistoryAsRead(); Dialogs::RowDescriptor chatListEntryBefore(