Drop outdated *Full.invite_link stored in the database.
This commit is contained in:
parent
d74749c813
commit
7aa71edad2
@ -9426,11 +9426,16 @@ void ContactsManager::on_load_chat_full_from_database(ChatId chat_id, string val
|
|||||||
Chat *c = get_chat(chat_id);
|
Chat *c = get_chat(chat_id);
|
||||||
CHECK(c != nullptr);
|
CHECK(c != nullptr);
|
||||||
|
|
||||||
|
bool need_invite_link = c->is_active && c->status.can_manage_invite_links();
|
||||||
|
bool have_invite_link = chat_full->invite_link.is_valid();
|
||||||
|
if (need_invite_link != have_invite_link) {
|
||||||
|
if (need_invite_link) {
|
||||||
// ignore ChatFull without invite link
|
// ignore ChatFull without invite link
|
||||||
if (c->is_active && c->status.is_administrator() && c->status.can_invite_users() &&
|
|
||||||
!chat_full->invite_link.is_valid()) {
|
|
||||||
chats_full_.erase(chat_id);
|
chats_full_.erase(chat_id);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
chat_full->invite_link = DialogInviteLink();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (td_->file_manager_->get_file_view(c->photo.small_file_id).get_unique_file_id() !=
|
if (td_->file_manager_->get_file_view(c->photo.small_file_id).get_unique_file_id() !=
|
||||||
@ -9525,10 +9530,16 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s
|
|||||||
Channel *c = get_channel(channel_id);
|
Channel *c = get_channel(channel_id);
|
||||||
CHECK(c != nullptr);
|
CHECK(c != nullptr);
|
||||||
|
|
||||||
|
bool need_invite_link = c->status.can_manage_invite_links();
|
||||||
|
bool have_invite_link = channel_full->invite_link.is_valid();
|
||||||
|
if (need_invite_link != have_invite_link) {
|
||||||
|
if (need_invite_link) {
|
||||||
// ignore ChannelFull without invite link
|
// ignore ChannelFull without invite link
|
||||||
if (c->status.is_administrator() && c->status.can_invite_users() && !channel_full->invite_link.is_valid()) {
|
|
||||||
channels_full_.erase(channel_id);
|
channels_full_.erase(channel_id);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
channel_full->invite_link = DialogInviteLink();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (td_->file_manager_->get_file_view(c->photo.small_file_id).get_unique_file_id() !=
|
if (td_->file_manager_->get_file_view(c->photo.small_file_id).get_unique_file_id() !=
|
||||||
@ -13818,8 +13829,7 @@ bool ContactsManager::is_chat_full_outdated(const ChatFull *chat_full, const Cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->is_active && c->status.is_administrator() && c->status.can_invite_users() &&
|
if (c->is_active && c->status.can_manage_invite_links() && !chat_full->invite_link.is_valid()) {
|
||||||
!chat_full->invite_link.is_valid()) {
|
|
||||||
LOG(INFO) << "Have outdated invite link in " << chat_id;
|
LOG(INFO) << "Have outdated invite link in " << chat_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user