mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improved processing of out expired voice messages.
This commit is contained in:
parent
85286684e3
commit
a1c7a48958
3 changed files with 34 additions and 5 deletions
|
@ -44,6 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lang/lang_cloud_manager.h"
|
#include "lang/lang_cloud_manager.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
#include "history/history_item_helpers.h"
|
||||||
#include "history/history_unread_things.h"
|
#include "history/history_unread_things.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "storage/storage_account.h"
|
#include "storage/storage_account.h"
|
||||||
|
@ -1204,11 +1205,12 @@ void Updates::applyUpdateNoPtsCheck(const MTPUpdate &update) {
|
||||||
item->markMediaAndMentionRead();
|
item->markMediaAndMentionRead();
|
||||||
_session->data().requestItemRepaint(item);
|
_session->data().requestItemRepaint(item);
|
||||||
|
|
||||||
if (item->out()
|
if (item->out()) {
|
||||||
&& item->history()->peer->isUser()
|
const auto user = item->history()->peer->asUser();
|
||||||
&& !requestingDifference()) {
|
if (user && !requestingDifference()) {
|
||||||
item->history()->peer->asUser()->madeAction(
|
user->madeAction(base::unixtime::now());
|
||||||
base::unixtime::now());
|
}
|
||||||
|
ClearMediaAsExpired(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
#include "data/data_changes.h"
|
#include "data/data_changes.h"
|
||||||
|
#include "data/data_document.h"
|
||||||
#include "data/data_group_call.h"
|
#include "data/data_group_call.h"
|
||||||
#include "data/data_forum.h"
|
#include "data/data_forum.h"
|
||||||
#include "data/data_forum_topic.h"
|
#include "data/data_forum_topic.h"
|
||||||
|
@ -783,3 +784,27 @@ void ShowTrialTranscribesToast(int left, TimeId until) {
|
||||||
.filter = filter,
|
.filter = filter,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearMediaAsExpired(not_null<HistoryItem*> item) {
|
||||||
|
if (const auto media = item->media()) {
|
||||||
|
if (!media->ttlSeconds()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (const auto document = media->document()) {
|
||||||
|
item->applyEditionToHistoryCleared();
|
||||||
|
auto text = (document->isVideoFile()
|
||||||
|
? tr::lng_ttl_video_expired
|
||||||
|
: document->isVoiceMessage()
|
||||||
|
? tr::lng_ttl_voice_expired
|
||||||
|
: document->isVideoMessage()
|
||||||
|
? tr::lng_ttl_round_expired
|
||||||
|
: tr::lng_message_empty)(tr::now, Ui::Text::WithEntities);
|
||||||
|
item->updateServiceText(PreparedServiceText{ std::move(text) });
|
||||||
|
} else if (const auto photo = media->photo()) {
|
||||||
|
item->applyEditionToHistoryCleared();
|
||||||
|
item->updateServiceText(PreparedServiceText{
|
||||||
|
tr::lng_ttl_photo_expired(tr::now, Ui::Text::WithEntities)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -156,3 +156,5 @@ ClickHandlerPtr JumpToStoryClickHandler(
|
||||||
CallId callId);
|
CallId callId);
|
||||||
|
|
||||||
void ShowTrialTranscribesToast(int left, TimeId until);
|
void ShowTrialTranscribesToast(int left, TimeId until);
|
||||||
|
|
||||||
|
void ClearMediaAsExpired(not_null<HistoryItem*> item);
|
||||||
|
|
Loading…
Add table
Reference in a new issue