Add story.sender_id.
This commit is contained in:
parent
978cd5ef34
commit
9d0ca2670e
@ -3634,6 +3634,7 @@ storyInteractionInfo view_count:int32 forward_count:int32 reaction_count:int32 r
|
||||
//@description Represents a story
|
||||
//@id Unique story identifier among stories of the given sender
|
||||
//@sender_chat_id Identifier of the chat that posted the story
|
||||
//@sender_id Identifier of the sender of the story; may be null if the story is posted on behalf of the sender_chat_id
|
||||
//@date Point in time (Unix timestamp) when the story was published
|
||||
//@is_being_sent True, if the story is being sent by the current user
|
||||
//@is_being_edited True, if the story is being edited by the current user
|
||||
@ -3655,7 +3656,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_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;
|
||||
story id:int32 sender_chat_id:int53 sender_id:MessageSender 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;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "td/telegram/logevent/LogEventHelper.h"
|
||||
#include "td/telegram/MediaArea.hpp"
|
||||
#include "td/telegram/MessageEntity.h"
|
||||
#include "td/telegram/MessageSender.h"
|
||||
#include "td/telegram/MessagesManager.h"
|
||||
#include "td/telegram/NotificationId.h"
|
||||
#include "td/telegram/NotificationManager.h"
|
||||
@ -1125,6 +1126,7 @@ void StoryManager::Story::store(StorerT &storer) const {
|
||||
bool has_areas = !areas_.empty();
|
||||
bool has_chosen_reaction_type = !chosen_reaction_type_.is_empty();
|
||||
bool has_forward_info = forward_info_ != nullptr;
|
||||
bool has_sender_dialog_id = sender_dialog_id_ != DialogId();
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_edited_);
|
||||
STORE_FLAG(is_pinned_);
|
||||
@ -1142,6 +1144,7 @@ void StoryManager::Story::store(StorerT &storer) const {
|
||||
STORE_FLAG(has_chosen_reaction_type);
|
||||
STORE_FLAG(is_outgoing_);
|
||||
STORE_FLAG(has_forward_info);
|
||||
STORE_FLAG(has_sender_dialog_id);
|
||||
END_STORE_FLAGS();
|
||||
store(date_, storer);
|
||||
store(expire_date_, storer);
|
||||
@ -1169,6 +1172,9 @@ void StoryManager::Story::store(StorerT &storer) const {
|
||||
if (has_forward_info) {
|
||||
store(forward_info_, storer);
|
||||
}
|
||||
if (has_sender_dialog_id) {
|
||||
store(sender_dialog_id_, storer);
|
||||
}
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
@ -1182,6 +1188,7 @@ void StoryManager::Story::parse(ParserT &parser) {
|
||||
bool has_areas;
|
||||
bool has_chosen_reaction_type;
|
||||
bool has_forward_info;
|
||||
bool has_sender_dialog_id;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_edited_);
|
||||
PARSE_FLAG(is_pinned_);
|
||||
@ -1199,6 +1206,7 @@ void StoryManager::Story::parse(ParserT &parser) {
|
||||
PARSE_FLAG(has_chosen_reaction_type);
|
||||
PARSE_FLAG(is_outgoing_);
|
||||
PARSE_FLAG(has_forward_info);
|
||||
PARSE_FLAG(has_sender_dialog_id);
|
||||
END_PARSE_FLAGS();
|
||||
parse(date_, parser);
|
||||
parse(expire_date_, parser);
|
||||
@ -1226,6 +1234,9 @@ void StoryManager::Story::parse(ParserT &parser) {
|
||||
if (has_forward_info) {
|
||||
parse(forward_info_, parser);
|
||||
}
|
||||
if (has_sender_dialog_id) {
|
||||
parse(sender_dialog_id_, parser);
|
||||
}
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
@ -1895,6 +1906,7 @@ void StoryManager::add_story_dependencies(Dependencies &dependencies, const Stor
|
||||
story->forward_info_->add_dependencies(dependencies);
|
||||
}
|
||||
story->interaction_info_.add_dependencies(dependencies);
|
||||
dependencies.add_message_sender_dependencies(story->sender_dialog_id_);
|
||||
story->privacy_rules_.add_dependencies(dependencies);
|
||||
if (story->content_ != nullptr) {
|
||||
add_story_content_dependencies(dependencies, story->content_.get());
|
||||
@ -3208,10 +3220,13 @@ td_api::object_ptr<td_api::story> StoryManager::get_story_object(StoryFullId sto
|
||||
story->is_update_sent_ = true;
|
||||
|
||||
return td_api::make_object<td_api::story>(
|
||||
story_id.get(), td_->dialog_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_interactions,
|
||||
has_expired_viewers, std::move(repost_info), std::move(interaction_info),
|
||||
story_id.get(), td_->dialog_manager_->get_chat_id_object(owner_dialog_id, "get_story_object"),
|
||||
story->sender_dialog_id_ == DialogId()
|
||||
? nullptr
|
||||
: get_message_sender_object(td_, story->sender_dialog_id_, "get_story_object 2"),
|
||||
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_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),
|
||||
get_formatted_text_object(*caption, true, get_story_content_duration(td_, content)));
|
||||
@ -3443,6 +3458,11 @@ StoryId StoryManager::on_get_new_story(DialogId owner_dialog_id,
|
||||
story->forward_info_ = std::move(forward_info);
|
||||
is_changed = true;
|
||||
}
|
||||
auto sender_dialog_id = story_item->from_id_ != nullptr ? DialogId(story_item->from_id_) : DialogId();
|
||||
if (sender_dialog_id != story->sender_dialog_id_) {
|
||||
story->sender_dialog_id_ = sender_dialog_id;
|
||||
is_changed = true;
|
||||
}
|
||||
if (!story_item->min_) {
|
||||
auto privacy_rules = UserPrivacySettingRules::get_user_privacy_setting_rules(td_, std::move(story_item->privacy_));
|
||||
auto interaction_info = StoryInteractionInfo(td_, std::move(story_item->views_));
|
||||
@ -4728,6 +4748,10 @@ void StoryManager::send_story(DialogId dialog_id, td_api::object_ptr<td_api::Inp
|
||||
td_->dialog_manager_->force_create_dialog(dialog_id, "send_story");
|
||||
|
||||
auto story = make_unique<Story>();
|
||||
if (dialog_id.get_type() == DialogType::Channel &&
|
||||
td_->contacts_manager_->is_megagroup_channel(dialog_id.get_channel_id())) {
|
||||
story->sender_dialog_id_ = td_->messages_manager_->get_dialog_default_send_message_as_dialog_id(dialog_id);
|
||||
}
|
||||
story->date_ = G()->unix_time();
|
||||
story->expire_date_ = story->date_ + active_period;
|
||||
story->is_pinned_ = is_pinned;
|
||||
@ -4797,6 +4821,7 @@ void StoryManager::do_send_story(unique_ptr<PendingStory> &&pending_story, vecto
|
||||
if (bad_parts.empty()) {
|
||||
if (!pending_story->story_id_.is_server()) {
|
||||
auto story = make_unique<Story>();
|
||||
story->sender_dialog_id_ = pending_story->story_->sender_dialog_id_;
|
||||
story->date_ = pending_story->story_->date_;
|
||||
story->expire_date_ = pending_story->story_->expire_date_;
|
||||
story->is_pinned_ = pending_story->story_->is_pinned_;
|
||||
|
@ -55,6 +55,7 @@ class Td;
|
||||
|
||||
class StoryManager final : public Actor {
|
||||
struct Story {
|
||||
DialogId sender_dialog_id_;
|
||||
int32 date_ = 0;
|
||||
int32 expire_date_ = 0;
|
||||
int32 receive_date_ = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user