Fix has_unread_active_stories for self.
This commit is contained in:
parent
c28286d110
commit
b5d513dba0
@ -13492,7 +13492,7 @@ void ContactsManager::on_update_user_has_stories(UserId user_id, bool has_storie
|
|||||||
|
|
||||||
void ContactsManager::on_update_user_has_stories(User *u, UserId user_id, bool has_stories, StoryId max_active_story_id,
|
void ContactsManager::on_update_user_has_stories(User *u, UserId user_id, bool has_stories, StoryId max_active_story_id,
|
||||||
StoryId max_read_story_id) {
|
StoryId max_read_story_id) {
|
||||||
auto has_unread_stories = get_has_unread_stories(u);
|
auto has_unread_stories = get_has_unread_stories(u, user_id);
|
||||||
if (u->has_stories != has_stories) {
|
if (u->has_stories != has_stories) {
|
||||||
LOG(DEBUG) << "Change has stories of " << user_id << " to " << has_stories;
|
LOG(DEBUG) << "Change has stories of " << user_id << " to " << has_stories;
|
||||||
u->has_stories = has_stories;
|
u->has_stories = has_stories;
|
||||||
@ -13512,7 +13512,7 @@ void ContactsManager::on_update_user_has_stories(User *u, UserId user_id, bool h
|
|||||||
u->max_read_story_id = max_read_story_id;
|
u->max_read_story_id = max_read_story_id;
|
||||||
u->need_save_to_database = true;
|
u->need_save_to_database = true;
|
||||||
}
|
}
|
||||||
if (has_unread_stories != get_has_unread_stories(u)) {
|
if (has_unread_stories != get_has_unread_stories(u, user_id)) {
|
||||||
u->is_changed = true;
|
u->is_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13530,12 +13530,12 @@ void ContactsManager::on_update_user_max_read_story_id(UserId user_id, StoryId m
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ContactsManager::on_update_user_max_read_story_id(User *u, UserId user_id, StoryId max_read_story_id) {
|
void ContactsManager::on_update_user_max_read_story_id(User *u, UserId user_id, StoryId max_read_story_id) {
|
||||||
auto has_unread_stories = get_has_unread_stories(u);
|
auto has_unread_stories = get_has_unread_stories(u, user_id);
|
||||||
if (max_read_story_id.get() > u->max_read_story_id.get()) {
|
if (max_read_story_id.get() > u->max_read_story_id.get()) {
|
||||||
u->max_read_story_id = max_read_story_id;
|
u->max_read_story_id = max_read_story_id;
|
||||||
u->need_save_to_database = true;
|
u->need_save_to_database = true;
|
||||||
}
|
}
|
||||||
if (has_unread_stories != get_has_unread_stories(u)) {
|
if (has_unread_stories != get_has_unread_stories(u, user_id)) {
|
||||||
u->is_changed = true;
|
u->is_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18879,7 +18879,10 @@ td_api::object_ptr<td_api::UserStatus> ContactsManager::get_user_status_object(U
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContactsManager::get_has_unread_stories(const User *u) {
|
bool ContactsManager::get_has_unread_stories(const User *u, UserId user_id) const {
|
||||||
|
if (user_id == get_my_id()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return u->has_stories && u->max_active_story_id.get() > u->max_read_story_id.get();
|
return u->has_stories && u->max_active_story_id.get() > u->max_read_story_id.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18934,7 +18937,7 @@ tl_object_ptr<td_api::user> ContactsManager::get_user_object(UserId user_id, con
|
|||||||
get_user_status_object(user_id, u), get_profile_photo_object(td_->file_manager_.get(), u->photo),
|
get_user_status_object(user_id, u), get_profile_photo_object(td_->file_manager_.get(), u->photo),
|
||||||
std::move(emoji_status), u->is_contact, u->is_mutual_contact, u->is_close_friend, u->is_verified, u->is_premium,
|
std::move(emoji_status), u->is_contact, u->is_mutual_contact, u->is_close_friend, u->is_verified, u->is_premium,
|
||||||
u->is_support, get_restriction_reason_description(u->restriction_reasons), u->is_scam, u->is_fake, u->has_stories,
|
u->is_support, get_restriction_reason_description(u->restriction_reasons), u->is_scam, u->is_fake, u->has_stories,
|
||||||
get_has_unread_stories(u), have_access, std::move(type), u->language_code, u->attach_menu_enabled);
|
get_has_unread_stories(u, user_id), have_access, std::move(type), u->language_code, u->attach_menu_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<int64> ContactsManager::get_user_ids_object(const vector<UserId> &user_ids, const char *source) const {
|
vector<int64> ContactsManager::get_user_ids_object(const vector<UserId> &user_ids, const char *source) const {
|
||||||
|
@ -1741,7 +1741,7 @@ class ContactsManager final : public Actor {
|
|||||||
|
|
||||||
void on_dismiss_suggested_action(SuggestedAction action, Result<Unit> &&result);
|
void on_dismiss_suggested_action(SuggestedAction action, Result<Unit> &&result);
|
||||||
|
|
||||||
static bool get_has_unread_stories(const User *u);
|
bool get_has_unread_stories(const User *u, UserId user_id) const;
|
||||||
|
|
||||||
td_api::object_ptr<td_api::updateUser> get_update_user_object(UserId user_id, const User *u) const;
|
td_api::object_ptr<td_api::updateUser> get_update_user_object(UserId user_id, const User *u) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user