Mark voice/video message as read on mention click.

Fixes #5623.
This commit is contained in:
John Preston 2020-04-13 13:35:36 +04:00
parent 1fdd591aa0
commit 63129072ba
1 changed files with 20 additions and 1 deletions

View File

@ -2913,7 +2913,26 @@ void HistoryWidget::historyDownClicked() {
}
void HistoryWidget::showNextUnreadMention() {
showHistory(_peer->id, _history->getMinLoadedUnreadMention());
const auto msgId = _history->getMinLoadedUnreadMention();
const auto already = (_showAtMsgId == msgId);
// Mark mention voice/video message as read.
// See https://github.com/telegramdesktop/tdesktop/issues/5623
if (msgId && already) {
const auto item = _history->owner().message(
_history->channelId(),
msgId);
if (const auto media = item ? item->media() : nullptr) {
if (const auto document = media->document()) {
if (!media->webpage()
&& (document->isVoiceMessage()
|| document->isVideoMessage())) {
document->owner().markMediaRead(document);
}
}
}
}
showHistory(_peer->id, msgId);
}
void HistoryWidget::saveEditMsg() {