diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 06bca57c..c27e6907 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog ========= +2.5.13 (Unreleased) +------------------- +- Enh: Automated code refactoring for HumHub 1.18.1 using Rector + 2.5.12 (August 4, 2026) ----------------------- - Fix #436: Fix subpages box width on small screens diff --git a/models/WikiPage.php b/models/WikiPage.php index 91e1e77f..4182e8d7 100644 --- a/models/WikiPage.php +++ b/models/WikiPage.php @@ -425,9 +425,7 @@ public function afterMove(?ContentContainerActiveRecord $container = null) public function getIsCategory(): bool { - if (!isset($this->_isCategory)) { - $this->_isCategory = !$this->isNewRecord && $this->findChildren()->exists(); - } + $this->_isCategory ??= !$this->isNewRecord && $this->findChildren()->exists(); return $this->_isCategory; } diff --git a/module.json b/module.json index b7a0a3d3..b1a02941 100644 --- a/module.json +++ b/module.json @@ -2,8 +2,10 @@ "id": "wiki", "name": "Wiki", "description": "Create and edit pages with this powerful tool. Build a collaborative knowledge base, view and share information with your colleagues.", - "keywords": ["wiki"], - "version": "2.5.12", + "keywords": [ + "wiki" + ], + "version": "2.5.13", "humhub": { "minVersion": "1.18.1", "maxVersion": "1.18" @@ -29,4 +31,4 @@ "resources/screenshot6.png", "resources/screenshot7.png" ] -} +} \ No newline at end of file diff --git a/widgets/CategoryListItem.php b/widgets/CategoryListItem.php index d20ef4f9..b7af763a 100644 --- a/widgets/CategoryListItem.php +++ b/widgets/CategoryListItem.php @@ -94,13 +94,9 @@ public function run() return ''; } - if ($this->showDrag === null) { - $this->showDrag = $this->canAdminister(); - } + $this->showDrag ??= $this->canAdminister(); - if ($this->showAddPage === null) { - $this->showAddPage = $this->canCreate(); - } + $this->showAddPage ??= $this->canCreate(); $displaySubPages = $this->maxLevel === null || $this->level < $this->maxLevel; @@ -137,18 +133,14 @@ public static function clear() private function canAdminister() { - if (static::$canAdminister === null) { - static::$canAdminister = $this->contentContainer->can(AdministerPages::class); - } + static::$canAdminister ??= $this->contentContainer->can(AdministerPages::class); return static::$canAdminister; } private function canCreate() { - if (static::$canCreate === null) { - static::$canCreate = (new WikiPage($this->contentContainer))->content->canEdit(); - } + static::$canCreate ??= (new WikiPage($this->contentContainer))->content->canEdit(); return static::$canCreate; } diff --git a/widgets/CategoryListView.php b/widgets/CategoryListView.php index 6c2e7013..a721ca7f 100644 --- a/widgets/CategoryListView.php +++ b/widgets/CategoryListView.php @@ -71,9 +71,7 @@ public function init() { parent::init(); - if ($this->service === null) { - $this->service = new HierarchyListService($this->contentContainer); - } + $this->service ??= new HierarchyListService($this->contentContainer); } /** diff --git a/widgets/WikiSearchForm.php b/widgets/WikiSearchForm.php index 35f6852e..2f6f98d8 100644 --- a/widgets/WikiSearchForm.php +++ b/widgets/WikiSearchForm.php @@ -34,9 +34,7 @@ public function init() { parent::init(); - if (!isset($this->placeholder)) { - $this->placeholder = Yii::t('WikiModule.base', 'Search'); - } + $this->placeholder ??= Yii::t('WikiModule.base', 'Search'); } /**