2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Don't autoread mentions with voice/video messages.

Voice/video message unread flag is the same that mention unread flag.
If we mark such mentions as read together with all others we mark
media as watched/listened instantly when they appear on the screen.

So now we mark as read only simple mentions, without "unread" media.
This commit is contained in:
John Preston
2018-12-26 14:28:24 +04:00
parent 874d76b16b
commit b00ca217b3
12 changed files with 43 additions and 21 deletions

View File

@@ -1172,7 +1172,8 @@ void ApiWrap::markMediaRead(
QVector<MTPint>>();
markedIds.reserve(items.size());
for (const auto item : items) {
if (!item->isMediaUnread() || (item->out() && !item->mentionsMe())) {
if ((!item->isUnreadMedia() || item->out())
&& !item->isUnreadMention()) {
continue;
}
item->markMediaRead();
@@ -1201,7 +1202,8 @@ void ApiWrap::markMediaRead(
}
void ApiWrap::markMediaRead(not_null<HistoryItem*> item) {
if (!item->isMediaUnread() || (item->out() && !item->mentionsMe())) {
if ((!item->isUnreadMedia() || item->out())
&& !item->isUnreadMention()) {
return;
}
item->markMediaRead();
@@ -3290,7 +3292,7 @@ void ApiWrap::applyUpdateNoPtsCheck(const MTPUpdate &update) {
auto possiblyReadMentions = base::flat_set<MsgId>();
for (const auto &msgId : d.vmessages.v) {
if (auto item = App::histItemById(NoChannel, msgId.v)) {
if (item->isMediaUnread()) {
if (item->isUnreadMedia() || item->isUnreadMention()) {
item->markMediaRead();
_session->data().requestItemRepaint(item);