Replace private forward name before forwarding.
This commit is contained in:
parent
8f2a09f2cb
commit
f644dedcfa
@ -4629,6 +4629,14 @@ RestrictedRights ContactsManager::get_secret_chat_default_permissions(SecretChat
|
||||
return RestrictedRights(true, true, true, true, true, true, true, true, false, false, false);
|
||||
}
|
||||
|
||||
string ContactsManager::get_user_private_forward_name(UserId user_id) {
|
||||
auto user_full = get_user_full_force(user_id);
|
||||
if (user_full != nullptr) {
|
||||
return user_full->private_forward_name;
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
string ContactsManager::get_dialog_about(DialogId dialog_id) {
|
||||
switch (dialog_id.get_type()) {
|
||||
case DialogType::User: {
|
||||
|
@ -107,6 +107,8 @@ class ContactsManager final : public Actor {
|
||||
RestrictedRights get_channel_default_permissions(ChannelId channel_id) const;
|
||||
RestrictedRights get_secret_chat_default_permissions(SecretChatId secret_chat_id) const;
|
||||
|
||||
string get_user_private_forward_name(UserId user_id);
|
||||
|
||||
string get_dialog_about(DialogId dialog_id);
|
||||
|
||||
bool is_update_about_username_change_received(UserId user_id) const;
|
||||
|
@ -26964,6 +26964,15 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages(
|
||||
|
||||
auto content = std::move(forwarded_message_contents[j].content);
|
||||
auto forward_info = create_message_forward_info(from_dialog_id, to_dialog_id, forwarded_message);
|
||||
if (forward_info != nullptr && !forward_info->is_imported && !is_forward_info_sender_hidden(forward_info.get()) &&
|
||||
!forward_info->message_id.is_valid() && !forward_info->sender_dialog_id.is_valid() &&
|
||||
forward_info->sender_user_id.is_valid()) {
|
||||
auto private_forward_name = td_->contacts_manager_->get_user_private_forward_name(forward_info->sender_user_id);
|
||||
if (!private_forward_name.empty()) {
|
||||
forward_info->sender_user_id = UserId();
|
||||
forward_info->sender_name = std::move(private_forward_name);
|
||||
}
|
||||
}
|
||||
|
||||
unique_ptr<Message> message;
|
||||
Message *m;
|
||||
|
Loading…
Reference in New Issue
Block a user