From 216b06fcca3fb787a7de9e3da23ee0772dcd0401 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 13 Jun 2024 17:08:58 +0200 Subject: [PATCH] Fix getPwrChat --- src/MTProtoTools/PeerHandler.php | 36 +++++--------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/src/MTProtoTools/PeerHandler.php b/src/MTProtoTools/PeerHandler.php index 4eed99e5b..230cd7c5d 100644 --- a/src/MTProtoTools/PeerHandler.php +++ b/src/MTProtoTools/PeerHandler.php @@ -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';