Skip to content

Commit

Permalink
Merge pull request #529 from humhub/fix/523-my-profile-filter2
Browse files Browse the repository at this point in the history
Fix #523: Global calendar: display the "My profile" filter only when …
  • Loading branch information
luke- authored Jan 24, 2025
2 parents 22e0e4b + 7fab253 commit 4f6569a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
3 changes: 2 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Changelog
------------------------
- Fix #525: Fix Space calendar header
- Enh #526: New event from the global calendar: display "Select space..." or "Select calendar..." prompt instead of first Space
- Enh: Show the "Filter by types" filter only if a list a type is available
- Enh #528: Show the "Filter by types" filter only if a list a type is available
- Fix #523: Global calendar: display the "My profile" filter only when the module is enabled in for the User account

1.7.1 (January 17, 2025)
------------------------
Expand Down
27 changes: 10 additions & 17 deletions tests/codeception/acceptance/GlobalCalendarCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ public function testGlobalCalendarCreateEntry(AcceptanceTester $I)
$I->see('Select calendars');
$I->waitForText('Space Event', null, '#calendar');

// Active space and profile filter
$I->click('.calendar_my_spaces');
$I->click('.calendar_my_profile');

$I->wait(2);

$I->waitForText('Space Event', null, '#calendar');

$I->wantToTest('the global calendar filters');
$I->amGoingTo('deselect the space clalendar filter');
$I->click('.calendar_my_spaces');
$I->wait(2);
$I->cantSee('Space Event', '#calendar');

$I->amGoingTo('activate the profile calendar module by creating a new event');
$I->click('.fc-today');
$I->expectTo('see the choose calendar modal');
Expand All @@ -75,12 +61,19 @@ public function testGlobalCalendarCreateEntry(AcceptanceTester $I)

//$I->wait(1);
$I->waitForText('My Test Profile Entry', null, '.fc-event-container');
$I->see('My Test Profile Entry', '.fc-title');

$I->waitForElementVisible('.calendar_my_spaces');
// Active space filter
$I->amGoingTo('Select the space calendar filter');
$I->click('.calendar_my_spaces');
$I->wait(2);
$I->waitForText('Space Event', null, '#calendar');

$I->waitForText('Space Event');
$I->see('My Test Profile Entry', '.fc-title');
$I->wantToTest('the global calendar filters');
$I->amGoingTo('deselect the space calendar filter');
$I->click('.calendar_my_spaces');
$I->wait(2);
$I->waitForText('Space Event', null, '#calendar');
}

/**
Expand Down
18 changes: 10 additions & 8 deletions widgets/views/calendarFilterBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@
<?= Yii::t('CalendarModule.views', 'Select calendars') ?>
</div>
<div style="display:inline-block; float:left;margin-right:10px;">
<div class="checkbox">
<label class="calendar_my_profile">
<input type="checkbox" name="selector" class="selectorCheckbox"
value="<?= ActiveQueryContent::USER_RELATED_SCOPE_OWN_PROFILE; ?>"
<?php if (in_array(ActiveQueryContent::USER_RELATED_SCOPE_OWN_PROFILE, $selectors)): ?>checked="checked"<?php endif; ?>>
<?= Yii::t('CalendarModule.views', 'My profile'); ?>
</label>
</div>
<?php if (Yii::$app->user->identity->moduleManager->isEnabled('calendar')): ?>
<div class="checkbox">
<label class="calendar_my_profile">
<input type="checkbox" name="selector" class="selectorCheckbox"
value="<?= ActiveQueryContent::USER_RELATED_SCOPE_OWN_PROFILE; ?>"
<?php if (in_array(ActiveQueryContent::USER_RELATED_SCOPE_OWN_PROFILE, $selectors)): ?>checked="checked"<?php endif; ?>>
<?= Yii::t('CalendarModule.views', 'My profile'); ?>
</label>
</div>
<?php endif; ?>
<div class="checkbox">
<label class="calendar_my_spaces">
<input type="checkbox" name="selector" class="selectorCheckbox"
Expand Down

0 comments on commit 4f6569a

Please sign in to comment.