Skip to content

Commit

Permalink
Fix #453: Profile Calendar not available when adding an event from th…
Browse files Browse the repository at this point in the history
…e global Calendar when the module is enabled in the profile
  • Loading branch information
marc-farre committed Feb 6, 2024
1 parent e115d16 commit 424b34c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 41 deletions.
82 changes: 41 additions & 41 deletions controllers/GlobalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,53 @@ public function actionIndex()
]);
}

/**
* @return array|mixed calendar selector settings
* @throws \Throwable
*/
private function getSelectorSettings()
{
if (Yii::$app->user->isGuest) {
return [];
}

return $this->getUserSettings()->getSerialized('lastSelectors', []);
}

/**
* @return \humhub\modules\content\components\ContentContainerSettingsManager
*/
public function getUserSettings()
{
if (Yii::$app->user->isGuest) {
return null;
}

/* @var $module \humhub\modules\calendar\Module */
$module = Yii::$app->getModule('calendar');
return $module->settings->user();
}

/**
* @return array|mixed calendar filter settings
* @throws \Throwable
*/
private function getFilterSettings()
{
if (Yii::$app->user->isGuest) {
return [];
}

return $this->getUserSettings()->getSerialized('lastFilters', []);
}

public function actionSelect($start = null, $end = null)
{
/* @var $user User */
$contentContainerSelection = [];
$user = Yii::$app->user->getIdentity();

if ($user->moduleManager->canEnable('calendar')) {
if ($user->moduleManager->isEnabled('calendar') || $user->moduleManager->canEnable('calendar')) {
$contentContainerSelection[$user->contentcontainer_id] = Yii::t('CalendarModule.base', 'Profile Calendar');
}

Expand Down Expand Up @@ -161,46 +201,6 @@ public function actionSelectSubmit($start = null, $end = null)
return Yii::$app->runAction('/calendar/entry/edit', $params);
}

/**
* @return array|mixed calendar selector settings
* @throws \Throwable
*/
private function getSelectorSettings()
{
if (Yii::$app->user->isGuest) {
return [];
}

return $this->getUserSettings()->getSerialized('lastSelectors', []);
}

/**
* @return array|mixed calendar filter settings
* @throws \Throwable
*/
private function getFilterSettings()
{
if (Yii::$app->user->isGuest) {
return [];
}

return $this->getUserSettings()->getSerialized('lastFilters', []);
}

/**
* @return \humhub\modules\content\components\ContentContainerSettingsManager
*/
public function getUserSettings()
{
if (Yii::$app->user->isGuest) {
return null;
}

/* @var $module \humhub\modules\calendar\Module */
$module = Yii::$app->getModule('calendar');
return $module->settings->user();
}

/**
* Loads entries within search interval, the given string contains timezone offset.
*
Expand Down
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 #443: Fix email subject on invite/add users
- Fix #447: Global calendar header redesign
- Enh #440: Extend list of fields for updating of sequence
- Fix #453: Profile Calendar not available when adding an event from the global Calendar when the module is enabled in the profile

1.5.8 (January 19, 2024)
------------------------
Expand Down

0 comments on commit 424b34c

Please sign in to comment.