Fix updateing pinned message.

GitOrigin-RevId: 55d651c182c379f194f3cd8fbbbfab47b3d3e9e4
This commit is contained in:
levlam 2019-02-01 16:43:55 +03:00
parent bdfd8f4523
commit d0fc6930e4

View File

@ -11593,6 +11593,9 @@ MessageId MessagesManager::get_dialog_pinned_message(DialogId dialog_id, Promise
return MessageId(); return MessageId();
} }
LOG(INFO) << "Get pinned message in " << dialog_id << " with "
<< (d->is_pinned_message_id_inited ? "inited" : "unknown") << " pinned " << d->pinned_message_id;
Promise<Unit> empty_promise; Promise<Unit> empty_promise;
auto &get_pinned_message_id_promise = d->is_pinned_message_id_inited ? empty_promise : promise; auto &get_pinned_message_id_promise = d->is_pinned_message_id_inited ? empty_promise : promise;
switch (dialog_id.get_type()) { switch (dialog_id.get_type()) {
@ -21643,7 +21646,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
m->sender_user_id == my_user_id); m->sender_user_id == my_user_id);
} }
} }
if (from_update && message_id.is_server()) { if (from_update && message_id.is_server() && message_content_type == MessageContentType::PinMessage) {
auto pinned_message_id = get_message_content_pinned_message_id(m->content.get()); auto pinned_message_id = get_message_content_pinned_message_id(m->content.get());
on_update_dialog_pinned_message_id(dialog_id, pinned_message_id); on_update_dialog_pinned_message_id(dialog_id, pinned_message_id);
} }