Init bio in fake updateGroupCallParticipant when joining call.

This commit is contained in:
levlam 2021-03-07 01:54:45 +03:00
parent 0615d1f61d
commit dd4aac2f57
3 changed files with 43 additions and 0 deletions

View File

@ -4769,6 +4769,43 @@ RestrictedRights ContactsManager::get_secret_chat_default_permissions(SecretChat
return RestrictedRights(true, true, true, true, true, true, true, true, false, false, false);
}
string ContactsManager::get_dialog_about(DialogId dialog_id) {
switch (dialog_id.get_type()) {
case DialogType::User: {
auto user_full = get_user_full_force(dialog_id.get_user_id());
if (user_full != nullptr) {
return user_full->about;
}
break;
}
case DialogType::Chat: {
auto chat_full = get_chat_full_force(dialog_id.get_chat_id(), "get_dialog_about");
if (chat_full != nullptr) {
return chat_full->description;
}
break;
}
case DialogType::Channel: {
auto channel_full = get_channel_full_force(dialog_id.get_channel_id(), "get_dialog_about");
if (channel_full != nullptr) {
return channel_full->description;
}
break;
}
case DialogType::SecretChat: {
auto user_full = get_user_full_force(get_secret_chat_user_id(dialog_id.get_secret_chat_id()));
if (user_full != nullptr) {
return user_full->about;
}
break;
}
case DialogType::None:
default:
UNREACHABLE();
}
return string();
}
int32 ContactsManager::get_secret_chat_date(SecretChatId secret_chat_id) const {
auto c = get_secret_chat(secret_chat_id);
if (c == nullptr) {

View File

@ -128,6 +128,8 @@ class ContactsManager : public Actor {
RestrictedRights get_channel_default_permissions(ChannelId channel_id) const;
RestrictedRights get_secret_chat_default_permissions(SecretChatId secret_chat_id) const;
string get_dialog_about(DialogId dialog_id);
bool is_update_about_username_change_received(UserId user_id) const;
void for_each_secret_chat_with_user(UserId user_id, std::function<void(SecretChatId)> f);

View File

@ -1564,6 +1564,9 @@ void GroupCallManager::join_group_call(GroupCallId group_call_id, DialogId as_di
if (!td_->messages_manager_->have_input_peer(as_dialog_id, AccessRights::Read)) {
return promise.set_error(Status::Error(400, "Can't access the chat"));
}
if (as_dialog_id.get_type() == DialogType::SecretChat) {
return promise.set_error(Status::Error(400, "Can't join voice chat as a secret chat"));
}
}
if (audio_source == 0) {
@ -1640,6 +1643,7 @@ void GroupCallManager::join_group_call(GroupCallId group_call_id, DialogId as_di
td_->messages_manager_->force_create_dialog(my_dialog_id, "join_group_call");
group_call_participant.dialog_id = my_dialog_id;
}
group_call_participant.about = td_->contacts_manager_->get_dialog_about(group_call_participant.dialog_id);
group_call_participant.audio_source = audio_source;
group_call_participant.joined_date = G()->unix_time();
// if can_self_unmute has never been inited from self-participant,