Hide EnableArchiveAndMuteNewChat suggested action when the corresponding setting is set.

This commit is contained in:
levlam 2023-07-14 15:31:27 +03:00
parent 0181baf1ad
commit d5c8a68876
2 changed files with 8 additions and 1 deletions

View File

@ -5224,7 +5224,7 @@ tMeUrls urls:vector<tMeUrl> = TMeUrls;
//@class SuggestedAction @description Describes an action suggested to the current user
//@description Suggests the user to enable "archive_and_mute_new_chats_from_unknown_users" option
//@description Suggests the user to enable archive_and_mute_new_chats_from_unknown_users setting in archiveChatListSettings
suggestedActionEnableArchiveAndMuteNewChats = SuggestedAction;
//@description Suggests the user to check whether they still remember their 2-step verification password

View File

@ -6,8 +6,10 @@
//
#include "td/telegram/GlobalPrivacySettings.h"
#include "td/telegram/ConfigManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/net/NetQueryCreator.h"
#include "td/telegram/SuggestedAction.h"
#include "td/telegram/Td.h"
#include "td/utils/buffer.h"
@ -111,6 +113,11 @@ void GlobalPrivacySettings::get_global_privacy_settings(
void GlobalPrivacySettings::set_global_privacy_settings(Td *td, GlobalPrivacySettings settings,
Promise<Unit> &&promise) {
if (settings.archive_and_mute_new_noncontact_peers_) {
send_closure(td->config_manager_, &ConfigManager::hide_suggested_action,
SuggestedAction{SuggestedAction::Type::EnableArchiveAndMuteNewChats});
}
td->create_handler<SetGlobalPrivacySettingsQuery>(std::move(promise))->send(std::move(settings));
}