Don't count non-member creator in administrator count.
This commit is contained in:
parent
44eba3d214
commit
1fa64892e1
@ -13862,8 +13862,8 @@ void ContactsManager::speculative_add_channel_user(ChannelId channel_id, UserId
|
|||||||
LOG(INFO) << "Speculatively change status of " << user_id << " in " << channel_id << " from " << old_status << " to "
|
LOG(INFO) << "Speculatively change status of " << user_id << " in " << channel_id << " from " << old_status << " to "
|
||||||
<< new_status;
|
<< new_status;
|
||||||
if (channel_full != nullptr) {
|
if (channel_full != nullptr) {
|
||||||
channel_full->is_changed |= speculative_add_count(channel_full->administrator_count,
|
channel_full->is_changed |= speculative_add_count(
|
||||||
new_status.is_administrator() - old_status.is_administrator());
|
channel_full->administrator_count, new_status.is_administrator_member() - old_status.is_administrator_member());
|
||||||
min_count = channel_full->administrator_count;
|
min_count = channel_full->administrator_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,6 +541,10 @@ class DialogParticipantStatus {
|
|||||||
return type_ == Type::Administrator || type_ == Type::Creator;
|
return type_ == Type::Administrator || type_ == Type::Creator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_administrator_member() const {
|
||||||
|
return type_ == Type::Administrator || (type_ == Type::Creator && is_member());
|
||||||
|
}
|
||||||
|
|
||||||
bool is_restricted() const {
|
bool is_restricted() const {
|
||||||
return type_ == Type::Restricted;
|
return type_ == Type::Restricted;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ class GetChannelAdministratorsQuery final : public Td::ResultHandler {
|
|||||||
administrators.reserve(participants->participants_.size());
|
administrators.reserve(participants->participants_.size());
|
||||||
for (auto &participant : participants->participants_) {
|
for (auto &participant : participants->participants_) {
|
||||||
DialogParticipant dialog_participant(std::move(participant), channel_type);
|
DialogParticipant dialog_participant(std::move(participant), channel_type);
|
||||||
if (!dialog_participant.is_valid() || !dialog_participant.status_.is_administrator() ||
|
if (!dialog_participant.is_valid() || !dialog_participant.status_.is_administrator_member() ||
|
||||||
dialog_participant.dialog_id_.get_type() != DialogType::User) {
|
dialog_participant.dialog_id_.get_type() != DialogType::User) {
|
||||||
LOG(ERROR) << "Receive " << dialog_participant << " as an administrator of " << channel_id_;
|
LOG(ERROR) << "Receive " << dialog_participant << " as an administrator of " << channel_id_;
|
||||||
continue;
|
continue;
|
||||||
@ -831,7 +831,7 @@ void DialogParticipantManager::process_dialog_join_requests(DialogId dialog_id,
|
|||||||
void DialogParticipantManager::speculative_update_dialog_administrators(DialogId dialog_id, UserId user_id,
|
void DialogParticipantManager::speculative_update_dialog_administrators(DialogId dialog_id, UserId user_id,
|
||||||
const DialogParticipantStatus &new_status,
|
const DialogParticipantStatus &new_status,
|
||||||
const DialogParticipantStatus &old_status) {
|
const DialogParticipantStatus &old_status) {
|
||||||
if (new_status.is_administrator() == old_status.is_administrator() &&
|
if (new_status.is_administrator_member() == old_status.is_administrator_member() &&
|
||||||
new_status.get_rank() == old_status.get_rank()) {
|
new_status.get_rank() == old_status.get_rank()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -840,7 +840,7 @@ void DialogParticipantManager::speculative_update_dialog_administrators(DialogId
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto administrators = it->second;
|
auto administrators = it->second;
|
||||||
if (new_status.is_administrator()) {
|
if (new_status.is_administrator_member()) {
|
||||||
bool is_found = false;
|
bool is_found = false;
|
||||||
for (auto &administrator : administrators) {
|
for (auto &administrator : administrators) {
|
||||||
if (administrator.get_user_id() == user_id) {
|
if (administrator.get_user_id() == user_id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user