diff --git a/CHANGELOG.md b/CHANGELOG.md index f6c0a72211..f8d7f3097f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,12 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - Support Nextcloud 34 (Hub 26 Spring) + - Make modal for sending out confirmations closeable + - Apply time zone to confirmation mail ## [9.1.1] - 2026-05-06 ### Fixed - Fix repairstep which deleted the display names from shares - - Make modal for sending out confirmations closeable ### Changed - Set default sort to last activity (renamed from last interaction) for poll list, navigation and dashboard diff --git a/lib/Model/Mail/ConfirmationMail.php b/lib/Model/Mail/ConfirmationMail.php index 05ffe07c4d..6266aec97a 100644 --- a/lib/Model/Mail/ConfirmationMail.php +++ b/lib/Model/Mail/ConfirmationMail.php @@ -9,6 +9,7 @@ namespace OCA\Polls\Model\Mail; +use DateTimeZone; use OCA\Polls\AppInfo\Application; use OCA\Polls\Db\Option; use OCA\Polls\Db\Poll; @@ -47,18 +48,21 @@ protected function buildBody(): void { $this->l10n->n('Confirmed option:', 'Confirmed options:', count($this->confirmedOptions)) ); + $useTimeZoneName = $this->poll->getTimezoneName() ?? $this->recipient->getTimeZoneName(); + $useTimeZone = new DateTimeZone($useTimeZoneName); + $localizedDateSpan = new DateTimeIntervalText($this->l10n); foreach ($this->confirmedOptions as $option) { if ($this->poll->getType() === Poll::TYPE_DATE) { - $dateTime = $option->getDateTime(); + $dateTime = $option->getDateTime()->setTimeZone($useTimeZone); if ($dateTime->getISO() === null) { continue; } $localizedDateSpan - ->setStartDateTime($option->getDateTime()) + ->setStartDateTime($dateTime) ->setInterval($option->getInterval()); $this->emailTemplate->addBodyListItem( @@ -72,7 +76,7 @@ protected function buildBody(): void { if ($this->poll->getType() === Poll::TYPE_DATE) { $this->emailTemplate->addBodyText( - $this->l10n->t('The used time zone is "%s", based on the detected time zone at your registration time. To view the times in your current time zone, enter the poll by clicking the button below.', $this->recipient->getTimeZoneName()) + $this->l10n->t('The used time zone is "%s". To view the times in your current time zone, enter the poll by clicking the button below.', $useTimeZoneName) ); } diff --git a/lib/Model/UserBase.php b/lib/Model/UserBase.php index d290d98d77..8a8c9a5404 100644 --- a/lib/Model/UserBase.php +++ b/lib/Model/UserBase.php @@ -24,7 +24,6 @@ use OCA\Polls\Model\User\User; use OCA\Polls\UserSession; use OCP\Collaboration\Collaborators\ISearch; -use OCP\IDateTimeZone; use OCP\IGroupManager; use OCP\IL10N; use OCP\Share\IShare; @@ -69,7 +68,6 @@ class UserBase implements JsonSerializable { protected string $description = ''; protected string $richObjectType = self::TYPE_USER; protected string $organisation = ''; - protected IDateTimeZone $timeZone; protected IGroupManager $groupManager; protected IL10N $l10n; protected UserSession $userSession; @@ -86,7 +84,6 @@ public function __construct( ) { $this->l10n = Container::getL10N(); $this->groupManager = Container::queryClass(IGroupManager::class); - $this->timeZone = Container::queryClass(IDateTimeZone::class); $this->userSession = Container::queryClass(UserSession::class); $this->appSettings = Container::queryClass(AppSettings::class); } @@ -172,14 +169,14 @@ public function getLocaleCodeIntl(): string { } public function getTimeZone(): DateTimeZone { - if ($this->timeZoneName) { - return new DateTimeZone($this->timeZoneName); - } - return new DateTimeZone($this->timeZone->getTimeZone()->getName()); + return new DateTimeZone($this->timeZoneName); } public function getTimeZoneName(): string { - return $this->timeZoneName; + if ($this->timeZoneName) { + return $this->timeZoneName; + } + return date_default_timezone_get(); } public function getDisplayName(): string {