feat: don't destroy expiring voice messages

This commit is contained in:
ZavaruKitsu 2024-01-05 17:23:00 +03:00
parent 6d39a5f1d2
commit 59c2cbaabc
2 changed files with 7 additions and 4 deletions

View file

@ -41,6 +41,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/item_text_options.h" #include "ui/item_text_options.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
// AyuGram includes
#include "ayu/ayu_settings.h"
namespace { namespace {
bool PeerCallKnown(not_null<PeerData*> peer) { bool PeerCallKnown(not_null<PeerData*> peer) {
@ -811,5 +815,6 @@ void ClearMediaAsExpired(not_null<HistoryItem*> item) {
} }
[[nodiscard]] bool IsVoiceOncePlayable(not_null<HistoryItem*> item) { [[nodiscard]] bool IsVoiceOncePlayable(not_null<HistoryItem*> item) {
return !item->out() && item->media()->ttlSeconds(); const auto settings = &AyuSettings::getInstance();
return !item->out() && item->media()->ttlSeconds() && !settings->saveDeletedMessages;
} }

View file

@ -1550,9 +1550,7 @@ TextWithEntities TransribedText(not_null<HistoryItem*> item) {
} }
bool ItemHasTtl(HistoryItem *item) { bool ItemHasTtl(HistoryItem *item) {
return (item && item->media()) return false; // AyuGram: allow downloading files with ttl
? (item->media()->ttlSeconds() > 0)
: false;
} }
} // namespace HistoryView } // namespace HistoryView