Improve source in get_channel_full_force.
This commit is contained in:
parent
bef7184566
commit
90967ba8cf
|
@ -13884,7 +13884,8 @@ void ContactsManager::update_chat_online_member_count(const ChatFull *chat_full,
|
|||
}
|
||||
|
||||
void ContactsManager::update_channel_online_member_count(ChannelId channel_id, bool is_from_server) {
|
||||
if (!is_megagroup_channel(channel_id) || get_channel_effective_has_hidden_participants(channel_id)) {
|
||||
if (!is_megagroup_channel(channel_id) ||
|
||||
get_channel_effective_has_hidden_participants(channel_id, "update_channel_online_member_count")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -14129,7 +14130,8 @@ void ContactsManager::on_get_channel_participants(
|
|||
LOG(INFO) << "Receive " << participants.size() << " " << filter << " members in " << channel_id;
|
||||
|
||||
bool is_full = offset == 0 && static_cast<int32>(participants.size()) < limit && total_count < limit;
|
||||
bool has_hidden_participants = get_channel_effective_has_hidden_participants(channel_id);
|
||||
bool has_hidden_participants =
|
||||
get_channel_effective_has_hidden_participants(channel_id, "on_get_channel_participants");
|
||||
bool is_full_recent = is_full && filter.is_recent() && !has_hidden_participants;
|
||||
|
||||
auto channel_type = get_channel_type(channel_id);
|
||||
|
@ -16997,10 +16999,10 @@ bool ContactsManager::get_channel_join_request(const Channel *c) {
|
|||
return c->join_request && c->is_megagroup && (is_channel_public(c) || c->has_linked_channel);
|
||||
}
|
||||
|
||||
ChannelId ContactsManager::get_channel_linked_channel_id(ChannelId channel_id) {
|
||||
ChannelId ContactsManager::get_channel_linked_channel_id(ChannelId channel_id, const char *source) {
|
||||
auto channel_full = get_channel_full_const(channel_id);
|
||||
if (channel_full == nullptr) {
|
||||
channel_full = get_channel_full_force(channel_id, true, "get_channel_linked_channel_id");
|
||||
channel_full = get_channel_full_force(channel_id, true, source);
|
||||
if (channel_full == nullptr) {
|
||||
return ChannelId();
|
||||
}
|
||||
|
@ -17008,10 +17010,10 @@ ChannelId ContactsManager::get_channel_linked_channel_id(ChannelId channel_id) {
|
|||
return channel_full->linked_channel_id;
|
||||
}
|
||||
|
||||
int32 ContactsManager::get_channel_slow_mode_delay(ChannelId channel_id) {
|
||||
int32 ContactsManager::get_channel_slow_mode_delay(ChannelId channel_id, const char *source) {
|
||||
auto channel_full = get_channel_full_const(channel_id);
|
||||
if (channel_full == nullptr) {
|
||||
channel_full = get_channel_full_force(channel_id, true, "get_channel_slow_mode_delay");
|
||||
channel_full = get_channel_full_force(channel_id, true, source);
|
||||
if (channel_full == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -17019,7 +17021,7 @@ int32 ContactsManager::get_channel_slow_mode_delay(ChannelId channel_id) {
|
|||
return channel_full->slow_mode_delay;
|
||||
}
|
||||
|
||||
bool ContactsManager::get_channel_effective_has_hidden_participants(ChannelId channel_id) {
|
||||
bool ContactsManager::get_channel_effective_has_hidden_participants(ChannelId channel_id, const char *source) {
|
||||
auto c = get_channel_force(channel_id);
|
||||
if (c == nullptr) {
|
||||
return true;
|
||||
|
@ -17030,7 +17032,7 @@ bool ContactsManager::get_channel_effective_has_hidden_participants(ChannelId ch
|
|||
|
||||
auto channel_full = get_channel_full_const(channel_id);
|
||||
if (channel_full == nullptr) {
|
||||
channel_full = get_channel_full_force(channel_id, true, "get_channel_effective_has_hidden_participants");
|
||||
channel_full = get_channel_full_force(channel_id, true, source);
|
||||
if (channel_full == nullptr) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -636,9 +636,9 @@ class ContactsManager final : public Actor {
|
|||
bool get_channel_has_linked_channel(ChannelId channel_id) const;
|
||||
bool get_channel_join_request(ChannelId channel_id) const;
|
||||
bool get_channel_can_be_deleted(ChannelId channel_id) const;
|
||||
ChannelId get_channel_linked_channel_id(ChannelId channel_id);
|
||||
int32 get_channel_slow_mode_delay(ChannelId channel_id);
|
||||
bool get_channel_effective_has_hidden_participants(ChannelId channel_id);
|
||||
ChannelId get_channel_linked_channel_id(ChannelId channel_id, const char *source);
|
||||
int32 get_channel_slow_mode_delay(ChannelId channel_id, const char *source);
|
||||
bool get_channel_effective_has_hidden_participants(ChannelId channel_id, const char *source);
|
||||
|
||||
void add_dialog_participant(DialogId dialog_id, UserId user_id, int32 forward_limit, Promise<Unit> &&promise);
|
||||
|
||||
|
|
|
@ -7022,7 +7022,8 @@ bool MessagesManager::is_active_message_reply_info(DialogId dialog_id, const Mes
|
|||
return false;
|
||||
}
|
||||
|
||||
auto linked_channel_id = td_->contacts_manager_->get_channel_linked_channel_id(channel_id);
|
||||
auto linked_channel_id =
|
||||
td_->contacts_manager_->get_channel_linked_channel_id(channel_id, "is_active_message_reply_info");
|
||||
if (!linked_channel_id.is_valid()) {
|
||||
// keep the comment button while linked channel is unknown
|
||||
send_closure_later(G()->contacts_manager(), &ContactsManager::load_channel_full, channel_id, false, Promise<Unit>(),
|
||||
|
@ -13122,8 +13123,8 @@ void MessagesManager::on_update_dialog_online_member_count_timeout(DialogId dial
|
|||
|
||||
if (dialog_id.get_type() == DialogType::Channel && !is_broadcast_channel(dialog_id)) {
|
||||
auto participant_count = td_->contacts_manager_->get_channel_participant_count(dialog_id.get_channel_id());
|
||||
auto has_hidden_participants =
|
||||
td_->contacts_manager_->get_channel_effective_has_hidden_participants(dialog_id.get_channel_id());
|
||||
auto has_hidden_participants = td_->contacts_manager_->get_channel_effective_has_hidden_participants(
|
||||
dialog_id.get_channel_id(), "on_update_dialog_online_member_count_timeout");
|
||||
if (participant_count == 0 || participant_count >= 195 || has_hidden_participants) {
|
||||
td_->create_handler<GetOnlinesQuery>()->send(dialog_id);
|
||||
} else {
|
||||
|
@ -18089,7 +18090,8 @@ Status MessagesManager::can_get_message_viewers(DialogId dialog_id, const Messag
|
|||
if (is_broadcast_channel(dialog_id)) {
|
||||
return Status::Error(400, "Can't get message viewers in channel chats");
|
||||
}
|
||||
if (td_->contacts_manager_->get_channel_effective_has_hidden_participants(dialog_id.get_channel_id())) {
|
||||
if (td_->contacts_manager_->get_channel_effective_has_hidden_participants(dialog_id.get_channel_id(),
|
||||
"can_get_message_viewers")) {
|
||||
return Status::Error(400, "Participant list is hidden in the chat");
|
||||
}
|
||||
participant_count = td_->contacts_manager_->get_channel_participant_count(dialog_id.get_channel_id());
|
||||
|
@ -20402,8 +20404,8 @@ void MessagesManager::open_dialog(Dialog *d) {
|
|||
auto channel_id = dialog_id.get_channel_id();
|
||||
if (!is_broadcast_channel(dialog_id)) {
|
||||
auto participant_count = td_->contacts_manager_->get_channel_participant_count(channel_id);
|
||||
auto has_hidden_participants =
|
||||
td_->contacts_manager_->get_channel_effective_has_hidden_participants(dialog_id.get_channel_id());
|
||||
auto has_hidden_participants = td_->contacts_manager_->get_channel_effective_has_hidden_participants(
|
||||
dialog_id.get_channel_id(), "open_dialog");
|
||||
if (participant_count < 195 && !has_hidden_participants) { // include unknown participant_count
|
||||
td_->contacts_manager_->get_channel_participants(
|
||||
channel_id, td_api::make_object<td_api::supergroupMembersFilterRecent>(), string(), 0, 200, 200, Auto());
|
||||
|
@ -20413,7 +20415,7 @@ void MessagesManager::open_dialog(Dialog *d) {
|
|||
reget_dialog_action_bar(dialog_id, "open_dialog", false);
|
||||
|
||||
if (td_->contacts_manager_->get_channel_has_linked_channel(channel_id)) {
|
||||
auto linked_channel_id = td_->contacts_manager_->get_channel_linked_channel_id(channel_id);
|
||||
auto linked_channel_id = td_->contacts_manager_->get_channel_linked_channel_id(channel_id, "open_dialog");
|
||||
if (!linked_channel_id.is_valid()) {
|
||||
// load linked_channel_id
|
||||
send_closure_later(G()->contacts_manager(), &ContactsManager::load_channel_full, channel_id, false,
|
||||
|
@ -24412,7 +24414,8 @@ unique_ptr<MessagesManager::Message> MessagesManager::create_message_to_send(
|
|||
}()) {
|
||||
m->reply_info.reply_count_ = 0;
|
||||
if (is_channel_post) {
|
||||
auto linked_channel_id = td_->contacts_manager_->get_channel_linked_channel_id(dialog_id.get_channel_id());
|
||||
auto linked_channel_id =
|
||||
td_->contacts_manager_->get_channel_linked_channel_id(dialog_id.get_channel_id(), "create_message_to_send");
|
||||
if (linked_channel_id.is_valid()) {
|
||||
m->reply_info.is_comment_ = true;
|
||||
m->reply_info.channel_id_ = linked_channel_id;
|
||||
|
@ -24807,7 +24810,8 @@ void MessagesManager::get_dialog_send_message_as_dialog_ids(
|
|||
std::multimap<int64, Sender> sorted_senders;
|
||||
|
||||
bool is_premium = td_->option_manager_->get_option_boolean("is_premium");
|
||||
auto linked_channel_id = td_->contacts_manager_->get_channel_linked_channel_id(dialog_id.get_channel_id());
|
||||
auto linked_channel_id = td_->contacts_manager_->get_channel_linked_channel_id(
|
||||
dialog_id.get_channel_id(), "get_dialog_send_message_as_dialog_ids");
|
||||
for (auto channel_id : created_public_broadcasts_) {
|
||||
int64 score = td_->contacts_manager_->get_channel_participant_count(channel_id);
|
||||
bool needs_premium = !is_premium && channel_id != linked_channel_id &&
|
||||
|
@ -34831,7 +34835,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
|||
}
|
||||
if (m->date + 3600 >= now && m->is_outgoing) {
|
||||
auto channel_id = dialog_id.get_channel_id();
|
||||
auto slow_mode_delay = td_->contacts_manager_->get_channel_slow_mode_delay(channel_id);
|
||||
auto slow_mode_delay = td_->contacts_manager_->get_channel_slow_mode_delay(channel_id, "add_message_to_dialog");
|
||||
auto status = td_->contacts_manager_->get_channel_status(dialog_id.get_channel_id());
|
||||
if (m->date + slow_mode_delay > now && !status.is_administrator()) {
|
||||
td_->contacts_manager_->on_update_channel_slow_mode_next_send_date(channel_id, m->date + slow_mode_delay);
|
||||
|
|
Loading…
Reference in New Issue
Block a user