Hide story list for stories of non-contacts.
This commit is contained in:
parent
f8c5220aad
commit
ffdebbea1f
@ -4954,7 +4954,7 @@ stories total_count:int32 stories:vector<story> = Stories;
|
||||
storyInfo story_id:int32 date:int32 = StoryInfo;
|
||||
|
||||
//@description Describes active stories sent by the same sender
|
||||
//@list Identifier of the story list in which the stories are shown
|
||||
//@list Identifier of the story list in which the stories are shown; maybe null if the stories aren't from a current user's contact
|
||||
//@story_sender_chat_id Identifier of the sender of the stories
|
||||
//@max_read_story_id Identifier of the last read active story
|
||||
//@stories Basic information about the stories; use getStory to get full information about the stories
|
||||
|
@ -11888,6 +11888,7 @@ void ContactsManager::update_user(User *u, UserId user_id, bool from_binlog, boo
|
||||
}
|
||||
if (u->is_is_contact_changed) {
|
||||
td_->messages_manager_->on_dialog_user_is_contact_updated(DialogId(user_id), u->is_contact);
|
||||
td_->story_manager_->on_dialog_user_is_contact_updated(DialogId(user_id));
|
||||
if (is_user_contact(u, user_id, false)) {
|
||||
auto user_full = get_user_full(user_id);
|
||||
if (user_full != nullptr && user_full->need_phone_number_privacy_exception) {
|
||||
|
@ -1457,16 +1457,14 @@ td_api::object_ptr<td_api::activeStories> StoryManager::get_active_stories_objec
|
||||
}
|
||||
}
|
||||
}
|
||||
bool stories_hidden = false;
|
||||
if (owner_dialog_id.get_type() == DialogType::User) {
|
||||
stories_hidden = td_->contacts_manager_->get_user_stories_hidden(owner_dialog_id.get_user_id());
|
||||
}
|
||||
td_api::object_ptr<td_api::StoryList> list;
|
||||
if (stories_hidden) {
|
||||
if (is_subscribed_to_dialog_stories(owner_dialog_id)) {
|
||||
if (td_->contacts_manager_->get_user_stories_hidden(owner_dialog_id.get_user_id())) {
|
||||
list = td_api::make_object<td_api::storyListHidden>();
|
||||
} else {
|
||||
list = td_api::make_object<td_api::storyListMain>();
|
||||
}
|
||||
}
|
||||
|
||||
return td_api::make_object<td_api::activeStories>(
|
||||
std::move(list), td_->messages_manager_->get_chat_id_object(owner_dialog_id, "get_active_stories_object"),
|
||||
@ -1931,12 +1929,31 @@ bool StoryManager::on_update_read_stories(DialogId owner_dialog_id, StoryId max_
|
||||
return false;
|
||||
}
|
||||
|
||||
void StoryManager::on_dialog_stories_hidden_updated(DialogId owner_dialog_id) {
|
||||
bool StoryManager::is_subscribed_to_dialog_stories(DialogId owner_dialog_id) const {
|
||||
switch (owner_dialog_id.get_type()) {
|
||||
case DialogType::User:
|
||||
return td_->contacts_manager_->is_user_contact(owner_dialog_id.get_user_id());
|
||||
case DialogType::Chat:
|
||||
case DialogType::Channel:
|
||||
case DialogType::SecretChat:
|
||||
case DialogType::None:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void StoryManager::on_dialog_user_is_contact_updated(DialogId owner_dialog_id) {
|
||||
if (active_stories_.count(owner_dialog_id)) {
|
||||
send_update_active_stories(owner_dialog_id);
|
||||
}
|
||||
}
|
||||
|
||||
void StoryManager::on_dialog_stories_hidden_updated(DialogId owner_dialog_id) {
|
||||
if (active_stories_.count(owner_dialog_id) && is_subscribed_to_dialog_stories(owner_dialog_id)) {
|
||||
send_update_active_stories(owner_dialog_id);
|
||||
}
|
||||
}
|
||||
|
||||
void StoryManager::on_get_story_views(const vector<StoryId> &story_ids,
|
||||
telegram_api::object_ptr<telegram_api::stories_storyViews> &&story_views) {
|
||||
schedule_interaction_info_update();
|
||||
|
@ -151,6 +151,8 @@ class StoryManager final : public Actor {
|
||||
|
||||
bool on_update_read_stories(DialogId owner_dialog_id, StoryId max_read_story_id);
|
||||
|
||||
void on_dialog_user_is_contact_updated(DialogId owner_dialog_id);
|
||||
|
||||
void on_dialog_stories_hidden_updated(DialogId owner_dialog_id);
|
||||
|
||||
Status can_get_story_viewers(StoryFullId story_full_id, const Story *story) const;
|
||||
@ -223,6 +225,8 @@ class StoryManager final : public Actor {
|
||||
|
||||
static bool is_active_story(const Story *story);
|
||||
|
||||
bool is_subscribed_to_dialog_stories(DialogId owner_dialog_id) const;
|
||||
|
||||
const Story *get_story(StoryFullId story_full_id) const;
|
||||
|
||||
Story *get_story_editable(StoryFullId story_full_id);
|
||||
|
Loading…
Reference in New Issue
Block a user