Skip to content

Commit

Permalink
fix(dav): add a new config key to check to retrigger regenerating bir…
Browse files Browse the repository at this point in the history
…thday calendars

So that birthday calendars are immediately updated and we don't need to wait for user to change a
card or disable/enable the calendar. We reuse the existing RegenerateBirthdayCalendars repair step
instead of adding a new one.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
  • Loading branch information
tcitworld committed Oct 2, 2023
1 parent 8e7bf7a commit 3ba9335
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions apps/dav/lib/Migration/RegenerateBirthdayCalendars.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
* @author Georg Ehrke <oc.list@georgehrke.com>
* @author Thomas Citharel <nextcloud@tcit.fr>
*
* @license GNU AGPL version 3 or any later version
*
Expand All @@ -30,36 +31,22 @@
use OCP\Migration\IRepairStep;

class RegenerateBirthdayCalendars implements IRepairStep {
private IJobList $jobList;
private IConfig $config;

/** @var IJobList */
private $jobList;

/** @var IConfig */
private $config;

/**
* @param IJobList $jobList
* @param IConfig $config
*/
public function __construct(IJobList $jobList,
IConfig $config) {
$this->jobList = $jobList;
$this->config = $config;
}

/**
* @return string
*/
public function getName() {
public function getName(): string {
return 'Regenerating birthday calendars to use new icons and fix old birthday events without year';
}

/**
* @param IOutput $output
*/
public function run(IOutput $output) {
public function run(IOutput $output): void {
// only run once
if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') {
if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes' && $this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForAlarmFix') === 'yes') {
$output->info('Repair step already executed');
return;
}
Expand All @@ -69,5 +56,6 @@ public function run(IOutput $output) {

// if all were done, no need to redo the repair during next upgrade
$this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes');
$this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForAlarmFix', 'yes');
}
}

0 comments on commit 3ba9335

Please sign in to comment.