Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog
- Fix #512: Validate `from` pagination cursor to prevent unbounded conversation loading
- Fix #514: Optimize pin icon rendering on the inbox message list
- Fix #515: Reduce database queries in the inbox list, conversation loading, reply action and unread count polling
- Enh: Automated code refactoring for HumHub 1.18.1 using Rector

3.3.12 (July 16, 2026)
----------------------
Expand Down
16 changes: 6 additions & 10 deletions models/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ public function getUsersCount(): int
return count($this->users);
}

if ($this->_userCount === null) {
$this->_userCount = $this->getUsers()->count();
}
$this->_userCount ??= $this->getUsers()->count();

return $this->_userCount;
}
Expand Down Expand Up @@ -283,13 +281,11 @@ public function getLastEntry(): ?MessageEntry
return $this->lastEntryRelation;
}

if ($this->_lastEntry === null) {
$this->_lastEntry = MessageEntry::find()
->where(['message_id' => $this->id])
->orderBy('created_at DESC')
->limit(1)
->one();
}
$this->_lastEntry ??= MessageEntry::find()
->where(['message_id' => $this->id])
->orderBy('created_at DESC')
->limit(1)
->one();

return $this->_lastEntry;
}
Expand Down
4 changes: 1 addition & 3 deletions models/UserMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ public static function invalidateNewMessageCountCache($userId): void

public static function findByUser($userId = null)
{
if ($userId === null) {
$userId = Yii::$app->user->id;
}
$userId ??= Yii::$app->user->id;

if ($userId instanceof User) {
$userId = $userId->id;
Expand Down
4 changes: 1 addition & 3 deletions search/SearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ public function getResults(int $maxResults): array
*/
public function getService(): MetaSearchService
{
if ($this->service === null) {
$this->service = new MetaSearchService($this);
}
$this->service ??= new MetaSearchService($this);

return $this->service;
}
Expand Down
4 changes: 1 addition & 3 deletions widgets/InboxMessagePreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ private function getOptions(): array

public function getMessage(): Message
{
if ($this->_message === null) {
$this->_message = $this->userMessage->message;
}
$this->_message ??= $this->userMessage->message;

return $this->_message;
}
Expand Down