Allow to pin messages in all private chats.
GitOrigin-RevId: b5f55c22a6ec5950f5b88b66726bce918112d57f
This commit is contained in:
parent
fd9732dcfa
commit
af6fe68c00
@ -4213,8 +4213,7 @@ RestrictedRights ContactsManager::get_user_default_permissions(UserId user_id) c
|
||||
return RestrictedRights(false, false, false, false, false, false, false, false, false, false, false);
|
||||
}
|
||||
|
||||
bool can_pin_messages = user_id == get_my_id(); /* TODO */
|
||||
return RestrictedRights(true, true, true, true, true, true, true, true, false, false, can_pin_messages);
|
||||
return RestrictedRights(true, true, true, true, true, true, true, true, false, false, true);
|
||||
}
|
||||
|
||||
RestrictedRights ContactsManager::get_chat_default_permissions(ChatId chat_id) const {
|
||||
@ -12421,7 +12420,6 @@ ContactsManager::UserFull *ContactsManager::add_user_full(UserId user_id) {
|
||||
auto &user_full_ptr = users_full_[user_id];
|
||||
if (user_full_ptr == nullptr) {
|
||||
user_full_ptr = make_unique<UserFull>();
|
||||
user_full_ptr->can_pin_messages = (user_id == get_my_id());
|
||||
}
|
||||
return user_full_ptr.get();
|
||||
}
|
||||
|
@ -683,7 +683,7 @@ class ContactsManager : public Actor {
|
||||
bool can_be_called = false;
|
||||
bool supports_video_calls = false;
|
||||
bool has_private_calls = false;
|
||||
bool can_pin_messages = false;
|
||||
bool can_pin_messages = true;
|
||||
bool need_phone_number_privacy_exception = false;
|
||||
|
||||
bool is_common_chat_count_changed = true;
|
||||
|
@ -29520,9 +29520,6 @@ void MessagesManager::pin_dialog_message(DialogId dialog_id, MessageId message_i
|
||||
Slice action = is_unpin ? Slice("unpin") : Slice("pin");
|
||||
switch (dialog_id.get_type()) {
|
||||
case DialogType::User:
|
||||
if (dialog_id != get_my_dialog_id()) { // TODO
|
||||
return promise.set_error(Status::Error(3, PSLICE() << "Can't " << action << " message in the private chat"));
|
||||
}
|
||||
break;
|
||||
case DialogType::Chat: {
|
||||
auto chat_id = dialog_id.get_chat_id();
|
||||
@ -29542,7 +29539,7 @@ void MessagesManager::pin_dialog_message(DialogId dialog_id, MessageId message_i
|
||||
break;
|
||||
}
|
||||
case DialogType::SecretChat:
|
||||
return promise.set_error(Status::Error(3, PSLICE() << "Can't " << action << " message in a secret chat"));
|
||||
return promise.set_error(Status::Error(3, PSLICE() << "Can't " << action << " messages in secret chats"));
|
||||
case DialogType::None:
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -32488,8 +32485,7 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
||||
// asynchronously get is_blocked from the server
|
||||
get_dialog_info_full(dialog_id, Auto());
|
||||
}
|
||||
if (being_added_dialog_id_ != dialog_id && !d->is_pinned_message_id_inited &&
|
||||
(dialog_id == get_my_dialog_id() || dialog_type != DialogType::User) && !td_->auth_manager_->is_bot()) {
|
||||
if (being_added_dialog_id_ != dialog_id && !d->is_pinned_message_id_inited && !td_->auth_manager_->is_bot()) {
|
||||
// asynchronously get dialog pinned message from the server
|
||||
get_dialog_pinned_message(dialog_id, Auto());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user