Add Story.is_being_edited.

This commit is contained in:
levlam 2023-07-11 00:33:25 +03:00
parent 989432d33e
commit 53ea5b0fa1
2 changed files with 8 additions and 9 deletions

View File

@ -4940,6 +4940,7 @@ storyInteractionInfo view_count:int32 recent_viewer_user_ids:vector<int53> = Sto
//@id Unique story identifier among stories of the given sender
//@sender_chat_id Identifier of the chat that posted the story
//@date Point in time (Unix timestamp) when the story was published
//@is_being_edited True, if the story is being edited by the current user
//@is_edited True, if the story was edited
//@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration
//@is_visible_only_for_self True, if the story is visible only for the current user
@ -4951,7 +4952,7 @@ storyInteractionInfo view_count:int32 recent_viewer_user_ids:vector<int53> = Sto
//@privacy_rules Privacy rules affecting story visibility; may be null if the story isn't owned
//@content Content of the story
//@caption Caption of the story
story id:int32 sender_chat_id:int53 date:int32 is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_forwarded:Bool can_be_replied:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo privacy_rules:userPrivacySettingRules content:StoryContent caption:formattedText = Story;
story id:int32 sender_chat_id:int53 date:int32 is_being_edited:Bool is_edited:Bool is_pinned:Bool is_visible_only_for_self:Bool can_be_forwarded:Bool can_be_replied:Bool can_get_viewers:Bool has_expired_viewers:Bool interaction_info:storyInteractionInfo privacy_rules:userPrivacySettingRules content:StoryContent 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;

View File

@ -1974,6 +1974,7 @@ td_api::object_ptr<td_api::story> StoryManager::get_story_object(StoryFullId sto
privacy_rules = story->privacy_rules_.get_user_privacy_setting_rules_object(td_);
}
bool is_being_edited = false;
bool is_edited = story->is_edited_;
auto story_id = story_full_id.get_story_id();
@ -1988,7 +1989,7 @@ td_api::object_ptr<td_api::story> StoryManager::get_story_object(StoryFullId sto
if (it->second->edit_caption_) {
caption = &it->second->caption_;
}
is_edited = true;
is_being_edited = true;
}
}
@ -2006,9 +2007,9 @@ 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_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_), std::move(privacy_rules),
get_story_content_object(td_, content),
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_),
std::move(privacy_rules), get_story_content_object(td_, content),
get_formatted_text_object(*caption, true, get_story_content_duration(td_, content)));
}
@ -3218,16 +3219,13 @@ void StoryManager::delete_pending_story(FileId file_id, unique_ptr<PendingStory>
}
CHECK(story->content_ != nullptr);
auto promises = std::move(it->second->promises_);
bool is_changed = it->second->content_ != nullptr ||
(it->second->edit_caption_ && it->second->caption_ != story->caption_) ||
(status.is_error() && !story->is_edited_);
auto log_event_id = it->second->log_event_id_;
if (log_event_id != 0) {
binlog_erase(G()->td_db()->get_binlog(), log_event_id);
}
being_edited_stories_.erase(it);
on_story_changed(story_full_id, story, is_changed, true);
on_story_changed(story_full_id, story, true, true);
if (status.is_ok()) {
set_promises(promises);