Rename storyViewer to storyInteraction.
This commit is contained in:
parent
ca2cf0e25c
commit
b3d19e51e5
@ -3406,20 +3406,20 @@ emojiCategoryTypeEmojiStatus = EmojiCategoryType;
|
||||
emojiCategoryTypeChatPhoto = EmojiCategoryType;
|
||||
|
||||
|
||||
//@description Represents a viewer of a story
|
||||
//@description Represents a view of a story
|
||||
//@user_id User identifier of the viewer
|
||||
//@view_date Approximate point in time (Unix timestamp) when the story was viewed
|
||||
//@block_list Block list to which the user is added; may be null if none
|
||||
//@chosen_reaction_type Type of the reaction that was chosen by the user; may be null if none
|
||||
storyViewer user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_type:ReactionType = StoryViewer;
|
||||
storyInteraction user_id:int53 view_date:int32 block_list:BlockList chosen_reaction_type:ReactionType = StoryInteraction;
|
||||
|
||||
//@description Represents a list of story viewers
|
||||
//@total_count Approximate total number of users found
|
||||
//@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
|
||||
//@description Represents a list of interactions with a story
|
||||
//@total_count Approximate total number of interactions found
|
||||
//@total_forward_count Approximate total number of found forwards and reposts
|
||||
//@total_reaction_count Approximate total number of found reactions
|
||||
//@interactions List of story interactions
|
||||
//@next_offset The offset for the next request. If empty, then there are no more results
|
||||
storyViewers total_count:int32 total_forward_count:int32 total_reaction_count:int32 viewers:vector<storyViewer> next_offset:string = StoryViewers;
|
||||
storyInteractions total_count:int32 total_forward_count:int32 total_reaction_count:int32 interactions:vector<storyInteraction> next_offset:string = StoryInteractions;
|
||||
|
||||
|
||||
//@description Describes position of a clickable rectangle area on a story media
|
||||
@ -3574,7 +3574,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r
|
||||
//@can_be_replied True, if the story can be replied in the chat with the story sender
|
||||
//@can_toggle_is_pinned True, if the story's is_pinned value can be changed
|
||||
//@can_get_statistics True, if the story statistics are available through getStoryStatistics
|
||||
//@can_get_viewers True, if users viewed the story can be received through getStoryViewers
|
||||
//@can_get_interactions True, if interactions with the story can be received through getStoryInteractions
|
||||
//@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago
|
||||
//@repost_info Information about the original story; may be null if the story wasn't reposted
|
||||
//@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions
|
||||
@ -3583,7 +3583,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r
|
||||
//@content Content of the story
|
||||
//@areas Clickable areas to be shown on the story content
|
||||
//@caption Caption of the story
|
||||
story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_viewers:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector<storyArea> caption:formattedText = Story;
|
||||
story id:int32 sender_chat_id:int53 date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_pinned:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector<storyArea> caption:formattedText = Story;
|
||||
|
||||
//@description Represents a list of stories @total_count Approximate total number of stories found @stories The list of stories
|
||||
stories total_count:int32 stories:vector<story> = Stories;
|
||||
@ -8201,14 +8201,14 @@ getStoryAvailableReactions row_size:int32 = AvailableReactions;
|
||||
//@update_recent_reactions Pass true if the reaction needs to be added to recent reactions
|
||||
setStoryReaction story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType update_recent_reactions:Bool = Ok;
|
||||
|
||||
//@description Returns viewers of a story. The method can be called only for stories posted on behalf of the current user
|
||||
//@description Returns interactions with a story. The method can be called only for stories posted on behalf of the current user
|
||||
//@story_id Story identifier
|
||||
//@query Query to search for in names and usernames of the viewers; may be empty to get all relevant viewers
|
||||
//@only_contacts Pass true to get only contacts; pass false to get all relevant viewers
|
||||
//@prefer_with_reaction Pass true to get viewers with reaction first; pass false to get viewers sorted just by view_date
|
||||
//@query Query to search for in names, usernames and titles; may be empty to get all relevant interactions
|
||||
//@only_contacts Pass true to get only interactions by contacts; pass false to get all relevant interactions
|
||||
//@prefer_with_reaction Pass true to get interactions with reaction first; pass false to get interactions sorted just by interaction date
|
||||
//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
|
||||
//@limit The maximum number of story viewers to return
|
||||
getStoryViewers story_id:int32 query:string only_contacts:Bool prefer_with_reaction:Bool offset:string limit:int32 = StoryViewers;
|
||||
//@limit The maximum number of story interactions to return
|
||||
getStoryInteractions story_id:int32 query:string only_contacts:Bool prefer_with_reaction:Bool offset:string limit:int32 = StoryInteractions;
|
||||
|
||||
//@description Reports a story to the Telegram moderators
|
||||
//@story_sender_chat_id The identifier of the sender of the story to report
|
||||
|
@ -2793,9 +2793,9 @@ bool StoryManager::has_unexpired_viewers(StoryFullId story_full_id, const Story
|
||||
G()->unix_time() < get_story_viewers_expire_date(story);
|
||||
}
|
||||
|
||||
void StoryManager::get_story_viewers(StoryId story_id, const string &query, bool only_contacts,
|
||||
bool prefer_with_reaction, const string &offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::storyViewers>> &&promise) {
|
||||
void StoryManager::get_story_interactions(StoryId story_id, const string &query, bool only_contacts,
|
||||
bool prefer_with_reaction, const string &offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::storyInteractions>> &&promise) {
|
||||
DialogId owner_dialog_id(td_->contacts_manager_->get_my_id());
|
||||
StoryFullId story_full_id{owner_dialog_id, story_id};
|
||||
const Story *story = get_story(story_full_id);
|
||||
@ -2805,17 +2805,13 @@ void StoryManager::get_story_viewers(StoryId story_id, const string &query, bool
|
||||
if (limit <= 0) {
|
||||
return promise.set_error(Status::Error(400, "Parameter limit must be positive"));
|
||||
}
|
||||
if (can_get_story_viewers(story_full_id, story, G()->unix_time()).is_error() ||
|
||||
story->interaction_info_.get_view_count() == 0) {
|
||||
return promise.set_value(td_api::make_object<td_api::storyViewers>());
|
||||
}
|
||||
|
||||
bool is_full = query.empty() && !only_contacts;
|
||||
bool is_first = is_full && offset.empty();
|
||||
auto query_promise = PromiseCreator::lambda(
|
||||
[actor_id = actor_id(this), story_id, is_full, is_first, promise = std::move(promise)](
|
||||
Result<telegram_api::object_ptr<telegram_api::stories_storyViewsList>> result) mutable {
|
||||
send_closure(actor_id, &StoryManager::on_get_story_viewers, story_id, is_full, is_first, std::move(result),
|
||||
send_closure(actor_id, &StoryManager::on_get_story_interactions, story_id, is_full, is_first, std::move(result),
|
||||
std::move(promise));
|
||||
});
|
||||
|
||||
@ -2823,10 +2819,10 @@ void StoryManager::get_story_viewers(StoryId story_id, const string &query, bool
|
||||
->send(owner_dialog_id, story_id, query, only_contacts, prefer_with_reaction, offset, limit);
|
||||
}
|
||||
|
||||
void StoryManager::on_get_story_viewers(
|
||||
void StoryManager::on_get_story_interactions(
|
||||
StoryId story_id, bool is_full, bool is_first,
|
||||
Result<telegram_api::object_ptr<telegram_api::stories_storyViewsList>> r_view_list,
|
||||
Promise<td_api::object_ptr<td_api::storyViewers>> &&promise) {
|
||||
Promise<td_api::object_ptr<td_api::storyInteractions>> &&promise) {
|
||||
G()->ignore_result_if_closing(r_view_list);
|
||||
if (r_view_list.is_error()) {
|
||||
return promise.set_error(r_view_list.move_as_error());
|
||||
@ -2838,11 +2834,11 @@ void StoryManager::on_get_story_viewers(
|
||||
StoryFullId story_full_id{owner_dialog_id, story_id};
|
||||
Story *story = get_story_editable(story_full_id);
|
||||
if (story == nullptr) {
|
||||
return promise.set_value(td_api::make_object<td_api::storyViewers>());
|
||||
return promise.set_value(td_api::make_object<td_api::storyInteractions>());
|
||||
}
|
||||
|
||||
td_->contacts_manager_->on_get_users(std::move(view_list->users_), "on_get_story_viewers");
|
||||
td_->contacts_manager_->on_get_chats(std::move(view_list->chats_), "on_get_story_viewers");
|
||||
td_->contacts_manager_->on_get_users(std::move(view_list->users_), "on_get_story_interactions");
|
||||
td_->contacts_manager_->on_get_chats(std::move(view_list->chats_), "on_get_story_interactions");
|
||||
|
||||
auto total_count = view_list->count_;
|
||||
if (total_count < 0 || static_cast<size_t>(total_count) < view_list->views_.size()) {
|
||||
@ -2882,7 +2878,7 @@ void StoryManager::on_get_story_viewers(
|
||||
|
||||
td_->contacts_manager_->on_view_dialog_active_stories(
|
||||
transform(story_viewers.get_user_ids(), [](UserId user_id) { return DialogId(user_id); }));
|
||||
promise.set_value(story_viewers.get_story_viewers_object(td_->contacts_manager_.get()));
|
||||
promise.set_value(story_viewers.get_story_interactions_object(td_->contacts_manager_.get()));
|
||||
}
|
||||
|
||||
void StoryManager::report_story(StoryFullId story_full_id, ReportReason &&reason, Promise<Unit> &&promise) {
|
||||
@ -3043,7 +3039,7 @@ td_api::object_ptr<td_api::story> StoryManager::get_story_object(StoryFullId sto
|
||||
auto can_toggle_is_pinned = can_toggle_story_is_pinned(story_full_id, story);
|
||||
auto unix_time = G()->unix_time();
|
||||
auto can_get_statistics = can_get_story_statistics(story_full_id, story);
|
||||
auto can_get_viewers = can_get_story_viewers(story_full_id, story, unix_time).is_ok();
|
||||
auto can_get_interactions = can_get_story_viewers(story_full_id, story, unix_time).is_ok();
|
||||
auto repost_info =
|
||||
story->forward_info_ != nullptr ? story->forward_info_->get_story_repost_info_object(td_) : nullptr;
|
||||
auto interaction_info = story->interaction_info_.get_story_interaction_info_object(td_);
|
||||
@ -3060,7 +3056,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(owner_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_deleted,
|
||||
can_be_edited, can_be_forwarded, can_be_replied, can_toggle_is_pinned, can_get_statistics, can_get_viewers,
|
||||
can_be_edited, can_be_forwarded, can_be_replied, can_toggle_is_pinned, can_get_statistics, can_get_interactions,
|
||||
has_expired_viewers, std::move(repost_info), 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),
|
||||
|
@ -263,9 +263,9 @@ class StoryManager final : public Actor {
|
||||
void set_story_reaction(StoryFullId story_full_id, ReactionType reaction_type, bool add_to_recent,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void get_story_viewers(StoryId story_id, const string &query, bool only_contacts, bool prefer_with_reaction,
|
||||
const string &offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::storyViewers>> &&promise);
|
||||
void get_story_interactions(StoryId story_id, const string &query, bool only_contacts, bool prefer_with_reaction,
|
||||
const string &offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::storyInteractions>> &&promise);
|
||||
|
||||
void report_story(StoryFullId story_full_id, ReportReason &&reason, Promise<Unit> &&promise);
|
||||
|
||||
@ -600,9 +600,9 @@ class StoryManager final : public Actor {
|
||||
|
||||
void set_story_stealth_mode(StoryStealthMode stealth_mode);
|
||||
|
||||
void on_get_story_viewers(StoryId story_id, bool is_full, bool is_first,
|
||||
Result<telegram_api::object_ptr<telegram_api::stories_storyViewsList>> r_view_list,
|
||||
Promise<td_api::object_ptr<td_api::storyViewers>> &&promise);
|
||||
void on_get_story_interactions(StoryId story_id, bool is_full, bool is_first,
|
||||
Result<telegram_api::object_ptr<telegram_api::stories_storyViewsList>> r_view_list,
|
||||
Promise<td_api::object_ptr<td_api::storyInteractions>> &&promise);
|
||||
|
||||
void on_set_story_reaction(StoryFullId story_full_id, Result<Unit> &&result, Promise<Unit> &&promise);
|
||||
|
||||
|
@ -14,10 +14,11 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
td_api::object_ptr<td_api::storyViewer> StoryViewer::get_story_viewer_object(ContactsManager *contacts_manager) const {
|
||||
td_api::object_ptr<td_api::storyInteraction> StoryViewer::get_story_interaction_object(
|
||||
ContactsManager *contacts_manager) const {
|
||||
auto block_list_id = BlockListId(is_blocked_, is_blocked_for_stories_);
|
||||
return td_api::make_object<td_api::storyViewer>(
|
||||
contacts_manager->get_user_id_object(user_id_, "get_story_viewer_object"), date_,
|
||||
return td_api::make_object<td_api::storyInteraction>(
|
||||
contacts_manager->get_user_id_object(user_id_, "get_story_interaction_object"), date_,
|
||||
block_list_id.get_block_list_object(), reaction_type_.get_reaction_type_object());
|
||||
}
|
||||
|
||||
@ -50,13 +51,13 @@ vector<UserId> StoryViewers::get_user_ids() const {
|
||||
return transform(story_viewers_, [](auto &viewer) { return viewer.get_user_id(); });
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::storyViewers> StoryViewers::get_story_viewers_object(
|
||||
td_api::object_ptr<td_api::storyInteractions> StoryViewers::get_story_interactions_object(
|
||||
ContactsManager *contacts_manager) const {
|
||||
return td_api::make_object<td_api::storyViewers>(
|
||||
return td_api::make_object<td_api::storyInteractions>(
|
||||
total_count_, total_forward_count_, total_reaction_count_,
|
||||
transform(story_viewers_,
|
||||
[contacts_manager](const StoryViewer &story_viewer) {
|
||||
return story_viewer.get_story_viewer_object(contacts_manager);
|
||||
return story_viewer.get_story_interaction_object(contacts_manager);
|
||||
}),
|
||||
next_offset_);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class StoryViewer {
|
||||
return user_id_;
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::storyViewer> get_story_viewer_object(ContactsManager *contacts_manager) const;
|
||||
td_api::object_ptr<td_api::storyInteraction> get_story_interaction_object(ContactsManager *contacts_manager) const;
|
||||
};
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewer &viewer);
|
||||
@ -60,7 +60,7 @@ class StoryViewers {
|
||||
|
||||
vector<UserId> get_user_ids() const;
|
||||
|
||||
td_api::object_ptr<td_api::storyViewers> get_story_viewers_object(ContactsManager *contacts_manager) const;
|
||||
td_api::object_ptr<td_api::storyInteractions> get_story_interactions_object(ContactsManager *contacts_manager) const;
|
||||
};
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewers &viewers);
|
||||
|
@ -6680,13 +6680,14 @@ void Td::on_request(uint64 id, const td_api::setStoryReaction &request) {
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::getStoryViewers &request) {
|
||||
void Td::on_request(uint64 id, td_api::getStoryInteractions &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.query_);
|
||||
CLEAN_INPUT_STRING(request.offset_);
|
||||
CREATE_REQUEST_PROMISE();
|
||||
story_manager_->get_story_viewers(StoryId(request.story_id_), request.query_, request.only_contacts_,
|
||||
request.prefer_with_reaction_, request.offset_, request.limit_, std::move(promise));
|
||||
story_manager_->get_story_interactions(StoryId(request.story_id_), request.query_, request.only_contacts_,
|
||||
request.prefer_with_reaction_, request.offset_, request.limit_,
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::reportStory &request) {
|
||||
|
@ -1061,7 +1061,7 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, const td_api::setStoryReaction &request);
|
||||
|
||||
void on_request(uint64 id, td_api::getStoryViewers &request);
|
||||
void on_request(uint64 id, td_api::getStoryInteractions &request);
|
||||
|
||||
void on_request(uint64 id, td_api::reportStory &request);
|
||||
|
||||
|
@ -4418,7 +4418,7 @@ class CliClient final : public Actor {
|
||||
get_args(args, story_sender_chat_id, story_id, reaction, update_recent_reactions);
|
||||
send_request(td_api::make_object<td_api::setStoryReaction>(story_sender_chat_id, story_id,
|
||||
as_reaction_type(reaction), update_recent_reactions));
|
||||
} else if (op == "gsv") {
|
||||
} else if (op == "gsi") {
|
||||
StoryId story_id;
|
||||
string limit;
|
||||
string offset;
|
||||
@ -4426,8 +4426,8 @@ class CliClient final : public Actor {
|
||||
bool only_contacts;
|
||||
bool prefer_with_reaction;
|
||||
get_args(args, story_id, limit, offset, query, only_contacts, prefer_with_reaction);
|
||||
send_request(td_api::make_object<td_api::getStoryViewers>(story_id, query, only_contacts, prefer_with_reaction,
|
||||
offset, as_limit(limit)));
|
||||
send_request(td_api::make_object<td_api::getStoryInteractions>(story_id, query, only_contacts,
|
||||
prefer_with_reaction, offset, as_limit(limit)));
|
||||
} else if (op == "rst") {
|
||||
ChatId story_sender_chat_id;
|
||||
StoryId story_id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user