Update BlockList in StoryViewers::StoryViewers.

This commit is contained in:
levlam 2023-12-25 15:52:03 +03:00
parent b3d19e51e5
commit a4ed86c44e
3 changed files with 7 additions and 11 deletions

View File

@ -2852,16 +2852,8 @@ void StoryManager::on_get_story_interactions(
total_reaction_count = total_count;
}
auto total_forward_count = max(view_list->forwards_count_, 0);
for (auto &view_ptr : view_list->views_) {
if (view_ptr->get_id() != telegram_api::storyView::ID) {
continue;
}
auto view = telegram_api::move_object_as<telegram_api::storyView>(view_ptr);
td_->contacts_manager_->on_update_user_is_blocked(UserId(view->user_id_), view->blocked_,
view->blocked_my_stories_from_);
}
StoryViewers story_viewers(total_count, total_forward_count, total_reaction_count, std::move(view_list->views_),
StoryViewers story_viewers(td_, total_count, total_forward_count, total_reaction_count, std::move(view_list->views_),
std::move(view_list->next_offset_));
if (story->content_ != nullptr) {
bool is_changed = false;

View File

@ -8,6 +8,7 @@
#include "td/telegram/BlockListId.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/Td.h"
#include "td/utils/algorithm.h"
#include "td/utils/logging.h"
@ -26,7 +27,7 @@ StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewer &view
return string_builder << '[' << viewer.user_id_ << " with " << viewer.reaction_type_ << " at " << viewer.date_ << ']';
}
StoryViewers::StoryViewers(int32 total_count, int32 total_forward_count, int32 total_reaction_count,
StoryViewers::StoryViewers(Td *td, int32 total_count, int32 total_forward_count, int32 total_reaction_count,
vector<telegram_api::object_ptr<telegram_api::StoryView>> &&story_views,
string &&next_offset)
: total_count_(total_count)
@ -38,6 +39,8 @@ StoryViewers::StoryViewers(int32 total_count, int32 total_forward_count, int32 t
continue;
}
auto story_view = telegram_api::move_object_as<telegram_api::storyView>(story_view_ptr);
td->contacts_manager_->on_update_user_is_blocked(UserId(story_view->user_id_), story_view->blocked_,
story_view->blocked_my_stories_from_);
story_viewers_.emplace_back(std::move(story_view));
auto user_id = story_viewers_.back().get_user_id();
if (!user_id.is_valid()) {

View File

@ -17,6 +17,7 @@
namespace td {
class ContactsManager;
class Td;
class StoryViewer {
UserId user_id_;
@ -55,7 +56,7 @@ class StoryViewers {
friend StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewers &viewers);
public:
StoryViewers(int32 total_count, int32 total_forward_count, int32 total_reaction_count,
StoryViewers(Td *td, int32 total_count, int32 total_forward_count, int32 total_reaction_count,
vector<telegram_api::object_ptr<telegram_api::StoryView>> &&story_views, string &&next_offset);
vector<UserId> get_user_ids() const;