Removed ability to save files with ttl.

This commit is contained in:
23rd 2024-01-03 12:23:41 +03:00
parent cee2961632
commit e52fe9ddb0
3 changed files with 15 additions and 2 deletions

View File

@ -2309,7 +2309,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
showContextInFolder(document);
}, &st::menuIconShowInFolder);
}
if (item && !hasCopyMediaRestriction(item)) {
if (item
&& !hasCopyMediaRestriction(item)
&& !HistoryView::ItemHasTtl(item)) {
HistoryView::AddSaveSoundForNotifications(
_menu,
item,

View File

@ -216,7 +216,7 @@ void AddSaveDocumentAction(
HistoryItem *item,
not_null<DocumentData*> document,
not_null<ListWidget*> list) {
if (list->hasCopyMediaRestriction(item)) {
if (list->hasCopyMediaRestriction(item) || ItemHasTtl(item)) {
return;
}
const auto origin = item ? item->fullId() : FullMsgId();
@ -1224,6 +1224,9 @@ void AddSaveSoundForNotifications(
not_null<HistoryItem*> item,
not_null<DocumentData*> document,
not_null<Window::SessionController*> controller) {
if (ItemHasTtl(item)) {
return;
}
const auto &ringtones = document->session().api().ringtones();
if (document->size > ringtones.maxSize()) {
return;
@ -1521,4 +1524,10 @@ TextWithEntities TransribedText(not_null<HistoryItem*> item) {
return {};
}
bool ItemHasTtl(HistoryItem *item) {
return (item && item->media())
? (item->media()->ttlSeconds() > 0)
: false;
}
} // namespace HistoryView

View File

@ -110,4 +110,6 @@ void AddEmojiPacksAction(
[[nodiscard]] TextWithEntities TransribedText(not_null<HistoryItem*> item);
[[nodiscard]] bool ItemHasTtl(HistoryItem *item);
} // namespace HistoryView