mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 05:58:58 +01:00
Compare commits
2 Commits
4b45fe7612
...
3680f649ae
Author | SHA1 | Date | |
---|---|---|---|
3680f649ae | |||
816af6f29f |
@ -58,7 +58,7 @@ abstract class AbstractPoll implements JsonSerializable
|
||||
public readonly array $recentVoters;
|
||||
|
||||
/** Total number of people that voted in the poll */
|
||||
public readonly int $totalVoters;
|
||||
public readonly ?int $totalVoters;
|
||||
|
||||
/** @internal */
|
||||
public function __construct(array $rawPoll)
|
||||
|
@ -190,6 +190,7 @@ final class PeerDatabase implements TLCallback
|
||||
} else {
|
||||
$this->processUser($id);
|
||||
}
|
||||
$this->recacheChatUsername($id, $this->db[$id] ?? null, []);
|
||||
unset($this->db[$id]);
|
||||
}
|
||||
|
||||
@ -313,7 +314,13 @@ final class PeerDatabase implements TLCallback
|
||||
}
|
||||
}
|
||||
$result = $this->usernames[$username];
|
||||
return $result === null ? $result : (int) $result;
|
||||
$id = $result === null ? $result : (int) $result;
|
||||
if (!$this->isset($id)) {
|
||||
$this->API->logger("No peer entry for cached username @$username => {$id}, dropping entry!");
|
||||
unset($this->usernames[$username]);
|
||||
return null;
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
private array $caching_simple_username = [];
|
||||
@ -419,7 +426,7 @@ final class PeerDatabase implements TLCallback
|
||||
$user['access_hash'] = $existingChat['access_hash'];
|
||||
}
|
||||
}
|
||||
$this->recacheChatUsername($user['id'], $existingChat, $user);
|
||||
$userUnchanged = $user;
|
||||
if (!$this->API->settings->getDb()->getEnablePeerInfoDb()) {
|
||||
$user = [
|
||||
'_' => $user['_'],
|
||||
@ -429,6 +436,7 @@ final class PeerDatabase implements TLCallback
|
||||
];
|
||||
}
|
||||
$this->db[$user['id']] = $user;
|
||||
$this->recacheChatUsername($user['id'], $existingChat, $userUnchanged);
|
||||
if ($existingChat && ($existingChat['min'] ?? false) && !($user['min'] ?? false)) {
|
||||
$this->API->minDatabase->clearPeer($user['id']);
|
||||
}
|
||||
@ -545,7 +553,6 @@ final class PeerDatabase implements TLCallback
|
||||
}
|
||||
}
|
||||
if ($existingChat != $chat) {
|
||||
$this->recacheChatUsername($bot_api_id, $existingChat, $chat);
|
||||
$this->API->logger("Updated chat {$bot_api_id}", Logger::ULTRA_VERBOSE);
|
||||
if (($chat['min'] ?? false) && $existingChat && !($existingChat['min'] ?? false)) {
|
||||
$this->API->logger("{$bot_api_id} is min, filling missing fields", Logger::ULTRA_VERBOSE);
|
||||
@ -557,6 +564,7 @@ final class PeerDatabase implements TLCallback
|
||||
}
|
||||
$chat = $newchat;
|
||||
}
|
||||
$chatUnchanged = $chat;
|
||||
if (!$this->API->settings->getDb()->getEnablePeerInfoDb()) {
|
||||
$chat = [
|
||||
'_' => $chat['_'],
|
||||
@ -566,6 +574,7 @@ final class PeerDatabase implements TLCallback
|
||||
];
|
||||
}
|
||||
$this->db[$bot_api_id] = $chat;
|
||||
$this->recacheChatUsername($bot_api_id, $existingChat, $chatUnchanged);
|
||||
if ($existingChat && ($existingChat['min'] ?? false) && !($chat['min'] ?? false)) {
|
||||
$this->API->minDatabase->clearPeer($bot_api_id);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user