Skip to content

Commit

Permalink
Merge pull request #49 from felixhahnweilheim/fix-update-when-inactive
Browse files Browse the repository at this point in the history
Fix update when inactive
  • Loading branch information
felixhahnweilheim authored Feb 12, 2024
2 parents 271f2be + 7e42ed3 commit e3c2820
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changelog
=========
## TBA
- Fix #49: module update with error logged when module is inactive

## 1.0.5 (23/1/2024)
- Fix #47: wrong message category of save button

Expand Down
13 changes: 7 additions & 6 deletions models/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ class Config extends \yii\base\Model

public $theme;

public $showButton;
public $showButton = true;

public function init()
{
parent::init();

$settings = Yii::$app->getModule('dark-mode')->settings;

$this->theme = $settings->get('theme');

$this->showButton = $settings->get('showButton', true);
$module = Yii::$app->getModule('dark-mode');
// make sure module is enabled before retrieving settings, see https://github.com/felixhahnweilheim/humhub-dark-mode/issues/48
if ($module) {
$this->theme = $module->settings->get('theme');
$this->showButton = $module->settings->get('showButton', $this->showButton);
}

// If no setting was found, get recommended theme or fallback (DarkHumHub)
if (empty($this->theme)) {
Expand Down

0 comments on commit e3c2820

Please sign in to comment.