1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 22:14:39 +01:00

Fix getPwrChat

This commit is contained in:
Daniil Gentili 2024-06-13 17:08:58 +02:00
parent 3b578f225a
commit 216b06fcca

View File

@ -753,9 +753,6 @@ trait PeerHandler
if (isset($full['full']['exported_invite']['link'])) {
$res['invite'] = $full['full']['exported_invite']['link'];
}
if (isset($full['full']['participants']['participants'])) {
$res['participants'] = $full['full']['participants']['participants'];
}
break;
}
if (isset($res['participants']) && $fullfetch) {
@ -765,27 +762,12 @@ trait PeerHandler
if (isset($participant['inviter_id'])) {
$newres['inviter'] = ($this->getPwrChat($participant['inviter_id'], false));
}
if (isset($participant['promoted_by'])) {
$newres['promoted_by'] = ($this->getPwrChat($participant['promoted_by'], false));
}
if (isset($participant['kicked_by'])) {
$newres['kicked_by'] = ($this->getPwrChat($participant['kicked_by'], false));
}
if (isset($participant['date'])) {
$newres['date'] = $participant['date'];
}
if (isset($participant['admin_rights'])) {
$newres['admin_rights'] = $participant['admin_rights'];
}
if (isset($participant['banned_rights'])) {
$newres['banned_rights'] = $participant['banned_rights'];
}
if (isset($participant['can_edit'])) {
$newres['can_edit'] = $participant['can_edit'];
}
if (isset($participant['left'])) {
$newres['left'] = $participant['left'];
}
switch ($participant['_']) {
case 'chatParticipant':
$newres['role'] = 'user';
@ -891,29 +873,21 @@ trait PeerHandler
$promises = [];
foreach ($gres['participants'] as $participant) {
$promises []= async(function () use (&$res, $participant): void {
$newres = [];
$newres = $participant;
unset($newres['user_id'], $newres['peer']);
$newres['user'] = ($this->getPwrChat($participant['user_id'] ?? $participant['peer'], false));
if (isset($participant['inviter_id'])) {
unset($newres['inviter_id']);
$newres['inviter'] = ($this->getPwrChat($participant['inviter_id'], false));
}
if (isset($participant['kicked_by'])) {
unset($newres['kicked_by']);
$newres['kicked_by'] = ($this->getPwrChat($participant['kicked_by'], false));
}
if (isset($participant['promoted_by'])) {
unset($newres['promoted_by']);
$newres['promoted_by'] = ($this->getPwrChat($participant['promoted_by'], false));
}
if (isset($participant['date'])) {
$newres['date'] = $participant['date'];
}
if (isset($participant['rank'])) {
$newres['rank'] = $participant['rank'];
}
if (isset($participant['admin_rights'])) {
$newres['admin_rights'] = $participant['admin_rights'];
}
if (isset($participant['banned_rights'])) {
$newres['banned_rights'] = $participant['banned_rights'];
}
switch ($participant['_']) {
case 'channelParticipantSelf':
$newres['role'] = 'user';