Do not send chat actions to offline users like the main Android client.
GitOrigin-RevId: 6299f69ade490fa10bad74779b30a0d73a145ff2
This commit is contained in:
parent
38f72b353a
commit
30471b7099
@ -12229,6 +12229,11 @@ bool ContactsManager::is_user_deleted(UserId user_id) const {
|
||||
return u == nullptr || u->is_deleted;
|
||||
}
|
||||
|
||||
bool ContactsManager::is_user_support(UserId user_id) const {
|
||||
auto u = get_user(user_id);
|
||||
return u != nullptr && !u->is_deleted && u->is_support;
|
||||
}
|
||||
|
||||
bool ContactsManager::is_user_bot(UserId user_id) const {
|
||||
auto u = get_user(user_id);
|
||||
return u != nullptr && !u->is_deleted && u->is_bot;
|
||||
@ -12260,6 +12265,11 @@ Result<BotData> ContactsManager::get_bot_data(UserId user_id) const {
|
||||
return bot_data;
|
||||
}
|
||||
|
||||
bool ContactsManager::is_user_online(UserId user_id) const {
|
||||
int32 was_online = get_user_was_online(get_user(user_id), user_id);
|
||||
return was_online > G()->unix_time();
|
||||
}
|
||||
|
||||
bool ContactsManager::is_user_status_exact(UserId user_id) const {
|
||||
auto u = get_user(user_id);
|
||||
return u != nullptr && !u->is_deleted && !u->is_bot && u->was_online > 0;
|
||||
|
@ -424,9 +424,13 @@ class ContactsManager : public Actor {
|
||||
|
||||
bool is_user_deleted(UserId user_id) const;
|
||||
|
||||
bool is_user_support(UserId user_id) const;
|
||||
|
||||
bool is_user_bot(UserId user_id) const;
|
||||
Result<BotData> get_bot_data(UserId user_id) const TD_WARN_UNUSED_RESULT;
|
||||
|
||||
bool is_user_online(UserId user_id) const;
|
||||
|
||||
bool is_user_status_exact(UserId user_id) const;
|
||||
|
||||
bool can_report_user(UserId user_id) const;
|
||||
|
@ -28853,10 +28853,20 @@ bool MessagesManager::is_dialog_action_unneeded(DialogId dialog_id) const {
|
||||
UserId user_id = dialog_type == DialogType::User
|
||||
? dialog_id.get_user_id()
|
||||
: td_->contacts_manager_->get_secret_chat_user_id(dialog_id.get_secret_chat_id());
|
||||
if (!user_id.is_valid() || td_->contacts_manager_->is_user_bot(user_id) ||
|
||||
td_->contacts_manager_->is_user_deleted(user_id)) {
|
||||
if (td_->contacts_manager_->is_user_deleted(user_id)) {
|
||||
return true;
|
||||
}
|
||||
if (td_->contacts_manager_->is_user_bot(user_id) && !td_->contacts_manager_->is_user_support(user_id)) {
|
||||
return true;
|
||||
}
|
||||
if (user_id == td_->contacts_manager_->get_my_id()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!td_->auth_manager_->is_bot() && !td_->contacts_manager_->is_user_online(user_id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!td_->auth_manager_->is_bot() && !td_->contacts_manager_->is_user_status_exact(user_id)) {
|
||||
// return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user