Improve story.has_expired_viewers.

This commit is contained in:
levlam 2023-08-12 21:55:30 +03:00
parent fd2df72321
commit a33ef5a055

View File

@ -2663,7 +2663,10 @@ td_api::object_ptr<td_api::story> StoryManager::get_story_object(StoryFullId sto
privacy_settings->get_id() == td_api::storyPrivacySettingsEveryone::ID;
bool can_be_replied = story_id.is_server() && dialog_id != changelog_dialog_id;
bool can_get_viewers = can_get_story_viewers(story_full_id, story, false).is_ok();
bool has_expired_viewers = !can_get_viewers && is_story_owned(dialog_id) && story_id.is_server();
auto interaction_info = story->interaction_info_.get_story_interaction_info_object(td_);
bool has_expired_viewers = !can_get_viewers && is_story_owned(dialog_id) && story_id.is_server() &&
interaction_info != nullptr &&
interaction_info->view_count_ > interaction_info->reaction_count_;
auto story_areas = transform(*areas, [](const MediaArea &media_area) { return media_area.get_story_area_object(); });
story->is_update_sent_ = true;
@ -2671,8 +2674,7 @@ td_api::object_ptr<td_api::story> StoryManager::get_story_object(StoryFullId sto
return td_api::make_object<td_api::story>(
story_id.get(), td_->messages_manager_->get_chat_id_object(dialog_id, "get_story_object"), story->date_,
is_being_sent, is_being_edited, is_edited, story->is_pinned_, is_visible_only_for_self, can_be_forwarded,
can_be_replied, can_get_viewers, has_expired_viewers,
story->interaction_info_.get_story_interaction_info_object(td_),
can_be_replied, can_get_viewers, has_expired_viewers, std::move(interaction_info),
story->chosen_reaction_type_.get_reaction_type_object(), std::move(privacy_settings),
get_story_content_object(td_, content), std::move(story_areas),
get_formatted_text_object(*caption, true, get_story_content_duration(td_, content)));