Add BusinessInfo dependencies.
This commit is contained in:
parent
9913390bfe
commit
0e4dc27542
@ -6,6 +6,8 @@
|
||||
//
|
||||
#include "td/telegram/BusinessAwayMessage.h"
|
||||
|
||||
#include "td/telegram/Dependencies.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
BusinessAwayMessage::BusinessAwayMessage(telegram_api::object_ptr<telegram_api::businessAwayMessage> away_message) {
|
||||
@ -49,6 +51,10 @@ telegram_api::object_ptr<telegram_api::inputBusinessAwayMessage> BusinessAwayMes
|
||||
recipients_.get_input_business_recipients(td));
|
||||
}
|
||||
|
||||
void BusinessAwayMessage::add_dependencies(Dependencies &dependencies) const {
|
||||
recipients_.add_dependencies(dependencies);
|
||||
}
|
||||
|
||||
bool operator==(const BusinessAwayMessage &lhs, const BusinessAwayMessage &rhs) {
|
||||
return lhs.shortcut_id_ == rhs.shortcut_id_ && lhs.recipients_ == rhs.recipients_ && lhs.schedule_ == rhs.schedule_ &&
|
||||
lhs.offline_only_ == rhs.offline_only_;
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
class Dependencies;
|
||||
class Td;
|
||||
|
||||
class BusinessAwayMessage {
|
||||
@ -39,6 +40,8 @@ class BusinessAwayMessage {
|
||||
return shortcut_id_.is_server();
|
||||
}
|
||||
|
||||
void add_dependencies(Dependencies &dependencies) const;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const;
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
//
|
||||
#include "td/telegram/BusinessGreetingMessage.h"
|
||||
|
||||
#include "td/telegram/Dependencies.h"
|
||||
|
||||
#include "td/utils/misc.h"
|
||||
|
||||
namespace td {
|
||||
@ -49,6 +51,10 @@ BusinessGreetingMessage::get_input_business_greeting_message(Td *td) const {
|
||||
shortcut_id_.get(), recipients_.get_input_business_recipients(td), inactivity_days_);
|
||||
}
|
||||
|
||||
void BusinessGreetingMessage::add_dependencies(Dependencies &dependencies) const {
|
||||
recipients_.add_dependencies(dependencies);
|
||||
}
|
||||
|
||||
bool operator==(const BusinessGreetingMessage &lhs, const BusinessGreetingMessage &rhs) {
|
||||
return lhs.shortcut_id_ == rhs.shortcut_id_ && lhs.recipients_ == rhs.recipients_ &&
|
||||
lhs.inactivity_days_ == rhs.inactivity_days_;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
class Dependencies;
|
||||
class Td;
|
||||
|
||||
class BusinessGreetingMessage {
|
||||
@ -40,6 +41,8 @@ class BusinessGreetingMessage {
|
||||
return shortcut_id_.is_server();
|
||||
}
|
||||
|
||||
void add_dependencies(Dependencies &dependencies) const;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const;
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
//
|
||||
#include "td/telegram/BusinessInfo.h"
|
||||
|
||||
#include "td/telegram/Dependencies.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
td_api::object_ptr<td_api::businessInfo> BusinessInfo::get_business_info_object(Td *td) const {
|
||||
@ -98,4 +100,9 @@ bool BusinessInfo::set_intro(unique_ptr<BusinessInfo> &business_info, BusinessIn
|
||||
return false;
|
||||
}
|
||||
|
||||
void BusinessInfo::add_dependencies(Dependencies &dependencies) const {
|
||||
away_message_.add_dependencies(dependencies);
|
||||
greeting_message_.add_dependencies(dependencies);
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
class Dependencies;
|
||||
class Td;
|
||||
|
||||
class BusinessInfo {
|
||||
@ -35,6 +36,8 @@ class BusinessInfo {
|
||||
|
||||
static bool set_intro(unique_ptr<BusinessInfo> &business_info, BusinessIntro &&intro);
|
||||
|
||||
void add_dependencies(Dependencies &dependencies) const;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const;
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "td/telegram/BusinessRecipients.h"
|
||||
|
||||
#include "td/telegram/ContactsManager.h"
|
||||
#include "td/telegram/Dependencies.h"
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/DialogManager.h"
|
||||
#include "td/telegram/Td.h"
|
||||
@ -162,6 +163,15 @@ BusinessRecipients::get_input_business_bot_recipients(Td *td) const {
|
||||
std::move(input_users), std::move(excluded_input_users));
|
||||
}
|
||||
|
||||
void BusinessRecipients::add_dependencies(Dependencies &dependencies) const {
|
||||
for (auto user_id : user_ids_) {
|
||||
dependencies.add(user_id);
|
||||
}
|
||||
for (auto user_id : excluded_user_ids_) {
|
||||
dependencies.add(user_id);
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(const BusinessRecipients &lhs, const BusinessRecipients &rhs) {
|
||||
return lhs.user_ids_ == rhs.user_ids_ && lhs.excluded_user_ids_ == rhs.excluded_user_ids_ &&
|
||||
lhs.existing_chats_ == rhs.existing_chats_ && lhs.new_chats_ == rhs.new_chats_ &&
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
class Dependencies;
|
||||
class Td;
|
||||
|
||||
class BusinessRecipients {
|
||||
@ -33,6 +34,8 @@ class BusinessRecipients {
|
||||
|
||||
telegram_api::object_ptr<telegram_api::inputBusinessBotRecipients> get_input_business_bot_recipients(Td *td) const;
|
||||
|
||||
void add_dependencies(Dependencies &dependencies) const;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const;
|
||||
|
||||
|
@ -9184,6 +9184,10 @@ void ContactsManager::on_load_user_full_from_database(UserId user_id, string val
|
||||
|
||||
Dependencies dependencies;
|
||||
dependencies.add(user_id);
|
||||
if (user_full->business_info != nullptr) {
|
||||
user_full->business_info->add_dependencies(dependencies);
|
||||
}
|
||||
dependencies.add(user_id);
|
||||
if (!dependencies.resolve_force(td_, "on_load_user_full_from_database")) {
|
||||
users_full_.erase(user_id);
|
||||
G()->td_db()->get_sqlite_pmc()->erase(get_user_full_database_key(user_id), Auto());
|
||||
|
Loading…
Reference in New Issue
Block a user