Add storyViewers.total_forward_count.

This commit is contained in:
levlam 2023-12-25 15:10:48 +03:00
parent c4efc0e2e0
commit ca2cf0e25c
4 changed files with 14 additions and 8 deletions

View File

@ -3414,11 +3414,12 @@ emojiCategoryTypeChatPhoto = EmojiCategoryType;
storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_type:ReactionType = StoryViewer; storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_type:ReactionType = StoryViewer;
//@description Represents a list of story viewers //@description Represents a list of story viewers
//@total_count Approximate total number of story viewers found //@total_count Approximate total number of users found
//@total_reaction_count Approximate total number of reactions set by found story viewers //@total_forward_count Approximate total number of forwards by found users
//@total_reaction_count Approximate total number of reactions set by found users
//@viewers List of story viewers //@viewers List of story viewers
//@next_offset The offset for the next request. If empty, then there are no more results //@next_offset The offset for the next request. If empty, then there are no more results
storyViewers total_count:int32 total_reaction_count:int32 viewers:vector<storyViewer> next_offset:string = StoryViewers; storyViewers total_count:int32 total_forward_count:int32 total_reaction_count:int32 viewers:vector<storyViewer> next_offset:string = StoryViewers;
//@description Describes position of a clickable rectangle area on a story media //@description Describes position of a clickable rectangle area on a story media

View File

@ -2855,6 +2855,7 @@ void StoryManager::on_get_story_viewers(
<< " story viewers"; << " story viewers";
total_reaction_count = total_count; total_reaction_count = total_count;
} }
auto total_forward_count = max(view_list->forwards_count_, 0);
for (auto &view_ptr : view_list->views_) { for (auto &view_ptr : view_list->views_) {
if (view_ptr->get_id() != telegram_api::storyView::ID) { if (view_ptr->get_id() != telegram_api::storyView::ID) {
continue; continue;
@ -2864,7 +2865,7 @@ void StoryManager::on_get_story_viewers(
view->blocked_my_stories_from_); view->blocked_my_stories_from_);
} }
StoryViewers story_viewers(total_count, total_reaction_count, std::move(view_list->views_), StoryViewers story_viewers(total_count, total_forward_count, total_reaction_count, std::move(view_list->views_),
std::move(view_list->next_offset_)); std::move(view_list->next_offset_));
if (story->content_ != nullptr) { if (story->content_ != nullptr) {
bool is_changed = false; bool is_changed = false;

View File

@ -25,10 +25,13 @@ StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewer &view
return string_builder << '[' << viewer.user_id_ << " with " << viewer.reaction_type_ << " at " << viewer.date_ << ']'; return string_builder << '[' << viewer.user_id_ << " with " << viewer.reaction_type_ << " at " << viewer.date_ << ']';
} }
StoryViewers::StoryViewers(int32 total_count, int32 total_reaction_count, StoryViewers::StoryViewers(int32 total_count, int32 total_forward_count, int32 total_reaction_count,
vector<telegram_api::object_ptr<telegram_api::StoryView>> &&story_views, vector<telegram_api::object_ptr<telegram_api::StoryView>> &&story_views,
string &&next_offset) string &&next_offset)
: total_count_(total_count), total_reaction_count_(total_reaction_count), next_offset_(std::move(next_offset)) { : total_count_(total_count)
, total_forward_count_(total_forward_count)
, total_reaction_count_(total_reaction_count)
, next_offset_(std::move(next_offset)) {
for (auto &story_view_ptr : story_views) { for (auto &story_view_ptr : story_views) {
if (story_view_ptr->get_id() != telegram_api::storyView::ID) { if (story_view_ptr->get_id() != telegram_api::storyView::ID) {
continue; continue;
@ -50,7 +53,7 @@ vector<UserId> StoryViewers::get_user_ids() const {
td_api::object_ptr<td_api::storyViewers> StoryViewers::get_story_viewers_object( td_api::object_ptr<td_api::storyViewers> StoryViewers::get_story_viewers_object(
ContactsManager *contacts_manager) const { ContactsManager *contacts_manager) const {
return td_api::make_object<td_api::storyViewers>( return td_api::make_object<td_api::storyViewers>(
total_count_, total_reaction_count_, total_count_, total_forward_count_, total_reaction_count_,
transform(story_viewers_, transform(story_viewers_,
[contacts_manager](const StoryViewer &story_viewer) { [contacts_manager](const StoryViewer &story_viewer) {
return story_viewer.get_story_viewer_object(contacts_manager); return story_viewer.get_story_viewer_object(contacts_manager);

View File

@ -47,6 +47,7 @@ StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewer &view
class StoryViewers { class StoryViewers {
int32 total_count_ = 0; int32 total_count_ = 0;
int32 total_forward_count_ = 0;
int32 total_reaction_count_ = 0; int32 total_reaction_count_ = 0;
vector<StoryViewer> story_viewers_; vector<StoryViewer> story_viewers_;
string next_offset_; string next_offset_;
@ -54,7 +55,7 @@ class StoryViewers {
friend StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewers &viewers); friend StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewers &viewers);
public: public:
StoryViewers(int32 total_count, int32 total_reaction_count, StoryViewers(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<telegram_api::object_ptr<telegram_api::StoryView>> &&story_views, string &&next_offset);
vector<UserId> get_user_ids() const; vector<UserId> get_user_ids() const;