Update member restrictions before returning it in getChatMember.
This commit is contained in:
parent
971de952d8
commit
8b5a55c798
@ -11808,7 +11808,7 @@ void ContactsManager::add_channel_participant_to_cache(ChannelId channel_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DialogParticipant *ContactsManager::get_channel_participant_from_cache(ChannelId channel_id,
|
const DialogParticipant *ContactsManager::get_channel_participant_from_cache(ChannelId channel_id,
|
||||||
DialogId participant_dialog_id) const {
|
DialogId participant_dialog_id) {
|
||||||
auto channel_participants_it = channel_participants_.find(channel_id);
|
auto channel_participants_it = channel_participants_.find(channel_id);
|
||||||
if (channel_participants_it == channel_participants_.end()) {
|
if (channel_participants_it == channel_participants_.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -11818,6 +11818,7 @@ const DialogParticipant *ContactsManager::get_channel_participant_from_cache(Cha
|
|||||||
CHECK(!participants.empty());
|
CHECK(!participants.empty());
|
||||||
auto it = participants.find(participant_dialog_id);
|
auto it = participants.find(participant_dialog_id);
|
||||||
if (it != participants.end()) {
|
if (it != participants.end()) {
|
||||||
|
it->second.participant_.status.update_restrictions();
|
||||||
it->second.last_access_date_ = G()->unix_time();
|
it->second.last_access_date_ = G()->unix_time();
|
||||||
return &it->second.participant_;
|
return &it->second.participant_;
|
||||||
}
|
}
|
||||||
@ -14918,6 +14919,7 @@ DialogParticipant ContactsManager::get_channel_participant(ChannelId channel_id,
|
|||||||
auto it = received_channel_participant_.find(random_id);
|
auto it = received_channel_participant_.find(random_id);
|
||||||
CHECK(it != received_channel_participant_.end());
|
CHECK(it != received_channel_participant_.end());
|
||||||
auto result = std::move(it->second);
|
auto result = std::move(it->second);
|
||||||
|
result.status.update_restrictions();
|
||||||
received_channel_participant_.erase(it);
|
received_channel_participant_.erase(it);
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
return result;
|
return result;
|
||||||
|
@ -1492,8 +1492,7 @@ class ContactsManager : public Actor {
|
|||||||
void add_channel_participant_to_cache(ChannelId channel_id, const DialogParticipant &dialog_participant,
|
void add_channel_participant_to_cache(ChannelId channel_id, const DialogParticipant &dialog_participant,
|
||||||
bool allow_replace);
|
bool allow_replace);
|
||||||
|
|
||||||
const DialogParticipant *get_channel_participant_from_cache(ChannelId channel_id,
|
const DialogParticipant *get_channel_participant_from_cache(ChannelId channel_id, DialogId participant_dialog_id);
|
||||||
DialogId participant_dialog_id) const;
|
|
||||||
|
|
||||||
void change_channel_participant_status_impl(ChannelId channel_id, DialogId participant_dialog_id,
|
void change_channel_participant_status_impl(ChannelId channel_id, DialogId participant_dialog_id,
|
||||||
DialogParticipantStatus status, DialogParticipantStatus old_status,
|
DialogParticipantStatus status, DialogParticipantStatus old_status,
|
||||||
@ -1657,7 +1656,7 @@ class ContactsManager : public Actor {
|
|||||||
struct ChannelParticipantInfo {
|
struct ChannelParticipantInfo {
|
||||||
DialogParticipant participant_;
|
DialogParticipant participant_;
|
||||||
|
|
||||||
mutable int32 last_access_date_ = 0;
|
int32 last_access_date_ = 0;
|
||||||
};
|
};
|
||||||
struct ChannelParticipants {
|
struct ChannelParticipants {
|
||||||
std::unordered_map<DialogId, ChannelParticipantInfo, DialogIdHash> participants_;
|
std::unordered_map<DialogId, ChannelParticipantInfo, DialogIdHash> participants_;
|
||||||
|
Loading…
Reference in New Issue
Block a user