diff --git a/Telegram/SourceFiles/boxes/auto_download_box.cpp b/Telegram/SourceFiles/boxes/auto_download_box.cpp index bb27db5933..21ac7a3140 100644 --- a/Telegram/SourceFiles/boxes/auto_download_box.cpp +++ b/Telegram/SourceFiles/boxes/auto_download_box.cpp @@ -43,8 +43,6 @@ void AutoDownloadBox::setupContent() { using namespace rpl::mappers; using Type = Data::AutoDownload::Type; - constexpr auto kLegacyLimit = 10 * 1024 * 1024; - setTitle(langFactory(lng_media_auto_title)); const auto settings = &Auth().settings().autoDownload(); diff --git a/Telegram/SourceFiles/data/data_auto_download.cpp b/Telegram/SourceFiles/data/data_auto_download.cpp index 290ecda9c8..31efcc02de 100644 --- a/Telegram/SourceFiles/data/data_auto_download.cpp +++ b/Telegram/SourceFiles/data/data_auto_download.cpp @@ -17,8 +17,7 @@ namespace Data { namespace AutoDownload { namespace { -constexpr auto kDefaultMaxSize = 10 * 1024 * 1024; -constexpr auto kNonCacheMaxSize = 2 * 1024 * 1024; +constexpr auto kDefaultMaxSize = 2 * 1024 * 1024; constexpr auto kVersion = char(1); template @@ -39,9 +38,12 @@ void SetDefaultsForSource(Full &data, Source source) { data.setBytesLimit(source, Type::VoiceMessage, kDefaultMaxSize); data.setBytesLimit(source, Type::VideoMessage, kDefaultMaxSize); data.setBytesLimit(source, Type::GIF, kDefaultMaxSize); - data.setBytesLimit(source, Type::File, kNonCacheMaxSize); - data.setBytesLimit(source, Type::Video, kNonCacheMaxSize); - data.setBytesLimit(source, Type::Music, kNonCacheMaxSize); + const auto channelsFileLimit = (source == Source::Channel) + ? 0 + : kDefaultMaxSize; + data.setBytesLimit(source, Type::File, channelsFileLimit); + data.setBytesLimit(source, Type::Video, channelsFileLimit); + data.setBytesLimit(source, Type::Music, channelsFileLimit); } const Full &Defaults() { diff --git a/Telegram/SourceFiles/storage/localstorage.cpp b/Telegram/SourceFiles/storage/localstorage.cpp index 7038e5278a..3680b3a337 100644 --- a/Telegram/SourceFiles/storage/localstorage.cpp +++ b/Telegram/SourceFiles/storage/localstorage.cpp @@ -1064,25 +1064,19 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting using namespace Data::AutoDownload; auto &settings = GetStoredAuthSessionCache().autoDownload(); - const auto limit = [](qint32 value, qint32 mask) { - constexpr auto kLegacyLimit = 10 * 1024 * 1024; - return (value & mask) ? 0 : kLegacyLimit; + const auto disabled = [](qint32 value, qint32 mask) { + return (value & mask) != 0; }; const auto set = [&](Type type, qint32 value) { constexpr auto kNoPrivate = qint32(0x01); constexpr auto kNoGroups = qint32(0x02); - settings.setBytesLimit( - Source::User, - type, - limit(value, kNoPrivate)); - settings.setBytesLimit( - Source::Group, - type, - limit(value, kNoGroups)); - settings.setBytesLimit( - Source::Channel, - type, - limit(value, kNoGroups)); + if (disabled(value, kNoPrivate)) { + settings.setBytesLimit(Source::User, type, 0); + } + if (disabled(value, kNoGroups)) { + settings.setBytesLimit(Source::Group, type, 0); + settings.setBytesLimit(Source::Channel, type, 0); + } }; set(Type::Photo, photo); set(Type::VoiceMessage, audio);