diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 2fccfcaa0..9843ae952 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -46,6 +46,7 @@ #include "td/telegram/ServerMessageId.h" #include "td/telegram/StickerPhotoSize.h" #include "td/telegram/StickersManager.h" +#include "td/telegram/StoryManager.h" #include "td/telegram/Td.h" #include "td/telegram/TdDb.h" #include "td/telegram/telegram_api.hpp" @@ -12498,6 +12499,8 @@ void ContactsManager::on_get_user_full(tl_object_ptr &&u td_->messages_manager_->on_update_dialog_is_translatable(DialogId(user_id), !user->translations_disabled_); + td_->story_manager_->on_get_user_stories(DialogId(user_id), std::move(user->stories_)); + UserFull *user_full = add_user_full(user_id); user_full->expires_at = Time::now() + USER_FULL_EXPIRE_TIME; diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index d5b853543..6ced66077 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -1157,7 +1157,10 @@ std::pair> StoryManager::on_get_stories( DialogId StoryManager::on_get_user_stories(DialogId owner_dialog_id, telegram_api::object_ptr &&user_stories) { - CHECK(user_stories != nullptr); + if (user_stories == nullptr) { + on_update_active_stories(owner_dialog_id, StoryId(), {}); + return owner_dialog_id; + } DialogId story_dialog_id(UserId(user_stories->user_id_)); if (owner_dialog_id.is_valid() && owner_dialog_id != story_dialog_id) { @@ -1211,6 +1214,10 @@ void StoryManager::on_update_active_stories(DialogId owner_dialog_id, StoryId ma max_read_story_id = StoryId(); } + if (owner_dialog_id.get_type() == DialogType::User) { + td_->contacts_manager_->on_update_user_has_stories(owner_dialog_id.get_user_id(), !story_ids.empty()); + } + if (max_read_story_id == StoryId() && story_ids.empty()) { if (active_stories_.erase(owner_dialog_id) > 0) { send_update_active_stories(owner_dialog_id); diff --git a/td/telegram/StoryManager.h b/td/telegram/StoryManager.h index 82382dc63..b30065b67 100644 --- a/td/telegram/StoryManager.h +++ b/td/telegram/StoryManager.h @@ -122,6 +122,9 @@ class StoryManager final : public Actor { std::pair> on_get_stories(DialogId owner_dialog_id, vector &&expected_story_ids, telegram_api::object_ptr &&stories); + DialogId on_get_user_stories(DialogId owner_dialog_id, + telegram_api::object_ptr &&user_stories); + void on_update_read_stories(DialogId owner_dialog_id, StoryId max_read_story_id); bool have_story(StoryFullId story_full_id) const; @@ -189,9 +192,6 @@ class StoryManager final : public Actor { void on_delete_story(DialogId owner_dialog_id, StoryId story_id); - DialogId on_get_user_stories(DialogId owner_dialog_id, - telegram_api::object_ptr &&user_stories); - void on_get_dialog_pinned_stories(DialogId owner_dialog_id, telegram_api::object_ptr &&stories, Promise> &&promise);