Skip to content

Commit

Permalink
Merge pull request 'fix: watermark - get timezone when userId is empt…
Browse files Browse the repository at this point in the history
…y' from hotfix/watermark-anon into develop

Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/onlyoffice-nextcloud/pulls/20
  • Loading branch information
LinneyS committed Nov 29, 2024
2 parents 5597c7d + ab78271 commit 86b9281
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Controller/EditorApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,11 @@ private function setWatermark($params, $isPublic, $userId, $file) {
);

if ($watermarkTemplate !== false) {
$timezone = $this->timezoneService->getUserTimezone($userId) ?? $this->timezoneService->getDefaultTimezone();
if (empty($userId)) {
$timezone = $this->timezoneService->getDefaultTimezone();
} else {
$timezone = $this->timezoneService->getUserTimezone($userId) ?? $this->timezoneService->getDefaultTimezone();
}
$replacements = [
"userId" => isset($userId) ? $userId : $this->trans->t('Anonymous'),
"date" => (new \DateTime("now", new \DateTimeZone($timezone)))->format("Y-m-d H:i:s"),
Expand Down

0 comments on commit 86b9281

Please sign in to comment.