Fix handling of 0 min boost level.

This commit is contained in:
levlam 2024-02-12 22:59:12 +03:00
parent 767336fb21
commit 02d1cef461
1 changed files with 22 additions and 18 deletions

View File

@ -462,10 +462,11 @@ ThemeManager::DialogBoostAvailableCounts ThemeManager::get_dialog_boost_availabl
: Slice("channel_wallpaper_level_min"))) {
result.chat_theme_count_ = static_cast<int32>(chat_themes_.themes.size());
}
{
auto &min_boost_levels =
for_megagroup ? accent_colors_.min_megagroup_boost_levels_ : accent_colors_.min_broadcast_boost_levels_;
for (size_t i = 0; i < min_boost_levels.size(); i++) {
if (level >= min_boost_levels[i]) {
if (level >= min_boost_levels[i] && min_boost_levels[i] != 0) {
result.accent_color_count_++;
if (accent_colors_.accent_color_ids_[i].is_built_in()) {
@ -480,13 +481,16 @@ ThemeManager::DialogBoostAvailableCounts ThemeManager::get_dialog_boost_availabl
}
}
}
}
{
auto &min_profile_boost_levels = for_megagroup ? profile_accent_colors_.min_megagroup_boost_levels_
: profile_accent_colors_.min_broadcast_boost_levels_;
for (size_t i = 0; i < min_profile_boost_levels.size(); i++) {
if (level >= min_profile_boost_levels[i]) {
if (level >= min_profile_boost_levels[i] && min_profile_boost_levels[i] != 0) {
result.profile_accent_color_count_++;
}
}
}
return result;
}