Improve StoryManager::can_get_story_viewers.

This commit is contained in:
levlam 2023-08-08 18:56:08 +03:00
parent 23212a271a
commit ca78c82e36
2 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,10 @@ class StoryInteractionInfo {
return view_count_ < 0;
}
bool has_hidden_viewers() const {
return view_count_ < 0 || (recent_viewer_user_ids_.empty() && view_count_ > 0);
}
void add_dependencies(Dependencies &dependencies) const;
bool set_counts(int32 view_count, int32 reaction_count) {

View File

@ -2345,7 +2345,7 @@ Status StoryManager::can_get_story_viewers(StoryFullId story_full_id, const Stor
return Status::Error(400, "Story is not sent yet");
}
if (G()->unix_time() >= get_story_viewers_expire_date(story) &&
(ignore_premium || story->interaction_info_.is_empty())) {
(ignore_premium || story->interaction_info_.has_hidden_viewers())) {
return Status::Error(400, "Story is too old");
}
return Status::OK();