aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/Controller/OutOfOfficeController.php10
-rw-r--r--apps/dav/lib/Db/Absence.php8
-rw-r--r--apps/dav/lib/ResponseDefinitions.php4
-rw-r--r--apps/dav/lib/Service/AbsenceService.php4
-rw-r--r--apps/dav/openapi.json10
-rw-r--r--lib/private/User/OutOfOfficeData.php8
-rw-r--r--lib/public/User/IOutOfOfficeData.php8
7 files changed, 27 insertions, 25 deletions
diff --git a/apps/dav/lib/Controller/OutOfOfficeController.php b/apps/dav/lib/Controller/OutOfOfficeController.php
index b77b77f4b5e..4978fb87737 100644
--- a/apps/dav/lib/Controller/OutOfOfficeController.php
+++ b/apps/dav/lib/Controller/OutOfOfficeController.php
@@ -105,8 +105,8 @@ class OutOfOfficeController extends OCSController {
* @param string $lastDay Last day of the absence in format `YYYY-MM-DD`
* @param string $status Short text that is set as user status during the absence
* @param string $message Longer multiline message that is shown to others during the absence
- * @param string $replacementUserId User id of the replacement user
- * @param string $replacementUserDisplayName Display name of the replacement user
+ * @param ?string $replacementUserId User id of the replacement user
+ * @param ?string $replacementUserDisplayName Display name of the replacement user
* @return DataResponse<Http::STATUS_OK, DAVOutOfOfficeData, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{error: 'firstDay'}, array{}>|DataResponse<Http::STATUS_UNAUTHORIZED, null, array{}>|DataResponse<Http::STATUS_NOT_FOUND, null, array{}>
*
* 200: Absence data
@@ -120,8 +120,8 @@ class OutOfOfficeController extends OCSController {
string $lastDay,
string $status,
string $message,
- string $replacementUserId = '',
- string $replacementUserDisplayName = ''
+ ?string $replacementUserId,
+ ?string $replacementUserDisplayName
): DataResponse {
$user = $this->userSession?->getUser();
@@ -129,7 +129,7 @@ class OutOfOfficeController extends OCSController {
return new DataResponse(null, Http::STATUS_UNAUTHORIZED);
}
- if ($replacementUserId !== '') {
+ if ($replacementUserId !== null) {
$replacementUser = $this->userManager->get($replacementUserId);
if ($replacementUser === null) {
return new DataResponse(null, Http::STATUS_NOT_FOUND);
diff --git a/apps/dav/lib/Db/Absence.php b/apps/dav/lib/Db/Absence.php
index c58593e3e3f..550958aaabd 100644
--- a/apps/dav/lib/Db/Absence.php
+++ b/apps/dav/lib/Db/Absence.php
@@ -30,9 +30,9 @@ use OCP\User\IOutOfOfficeData;
* @method string getMessage()
* @method void setMessage(string $message)
* @method string getReplacementUserId()
- * @method void setReplacementUserId(string $replacementUserId)
+ * @method void setReplacementUserId(?string $replacementUserId)
* @method string getReplacementUserDisplayName()
- * @method void setReplacementUserDisplayName(string $replacementUserDisplayName)
+ * @method void setReplacementUserDisplayName(?string $replacementUserDisplayName)
*/
class Absence extends Entity implements JsonSerializable {
protected string $userId = '';
@@ -47,9 +47,9 @@ class Absence extends Entity implements JsonSerializable {
protected string $message = '';
- protected string $replacementUserId = '';
+ protected ?string $replacementUserId = null;
- protected string $replacementUserDisplayName = '';
+ protected ?string $replacementUserDisplayName = null;
public function __construct() {
$this->addType('userId', 'string');
diff --git a/apps/dav/lib/ResponseDefinitions.php b/apps/dav/lib/ResponseDefinitions.php
index 467c9a7b8bb..2dc0d4e8dbd 100644
--- a/apps/dav/lib/ResponseDefinitions.php
+++ b/apps/dav/lib/ResponseDefinitions.php
@@ -13,8 +13,8 @@ namespace OCA\DAV;
* @psalm-type DAVOutOfOfficeDataCommon = array{
* userId: string,
* message: string,
- * replacementUserId: string,
- * replacementUserDisplayName: string,
+ * replacementUserId: ?string,
+ * replacementUserDisplayName: ?string,
* }
*
* @psalm-type DAVOutOfOfficeData = DAVOutOfOfficeDataCommon&array{
diff --git a/apps/dav/lib/Service/AbsenceService.php b/apps/dav/lib/Service/AbsenceService.php
index 91e0b538c43..7cbc0386d43 100644
--- a/apps/dav/lib/Service/AbsenceService.php
+++ b/apps/dav/lib/Service/AbsenceService.php
@@ -61,8 +61,8 @@ class AbsenceService {
$absence->setLastDay($lastDay);
$absence->setStatus($status);
$absence->setMessage($message);
- $absence->setReplacementUserId($replacementUserId ?? '');
- $absence->setReplacementUserDisplayName($replacementUserDisplayName ?? '');
+ $absence->setReplacementUserId($replacementUserId);
+ $absence->setReplacementUserDisplayName($replacementUserDisplayName);
if ($absence->getId() === null) {
$absence = $this->absenceMapper->insert($absence);
diff --git a/apps/dav/openapi.json b/apps/dav/openapi.json
index d565035b8ac..946a603f44d 100644
--- a/apps/dav/openapi.json
+++ b/apps/dav/openapi.json
@@ -145,10 +145,12 @@
"type": "string"
},
"replacementUserId": {
- "type": "string"
+ "type": "string",
+ "nullable": true
},
"replacementUserDisplayName": {
- "type": "string"
+ "type": "string",
+ "nullable": true
}
}
}
@@ -578,12 +580,12 @@
},
"replacementUserId": {
"type": "string",
- "default": "",
+ "nullable": true,
"description": "User id of the replacement user"
},
"replacementUserDisplayName": {
"type": "string",
- "default": "",
+ "nullable": true,
"description": "Display name of the replacement user"
}
}
diff --git a/lib/private/User/OutOfOfficeData.php b/lib/private/User/OutOfOfficeData.php
index 2d90dbfd39c..b1739126443 100644
--- a/lib/private/User/OutOfOfficeData.php
+++ b/lib/private/User/OutOfOfficeData.php
@@ -19,8 +19,8 @@ class OutOfOfficeData implements IOutOfOfficeData {
private int $endDate,
private string $shortMessage,
private string $message,
- private string $replacementUserId,
- private string $replacementUserDisplayName) {
+ private ?string $replacementUserId,
+ private ?string $replacementUserDisplayName) {
}
public function getId(): string {
@@ -47,11 +47,11 @@ class OutOfOfficeData implements IOutOfOfficeData {
return $this->message;
}
- public function getReplacementUserId(): string {
+ public function getReplacementUserId(): ?string {
return $this->replacementUserId;
}
- public function getReplacementUserDisplayName(): string {
+ public function getReplacementUserDisplayName(): ?string {
return $this->replacementUserDisplayName;
}
diff --git a/lib/public/User/IOutOfOfficeData.php b/lib/public/User/IOutOfOfficeData.php
index 19cc1120c4c..e3a4e2773bb 100644
--- a/lib/public/User/IOutOfOfficeData.php
+++ b/lib/public/User/IOutOfOfficeData.php
@@ -22,8 +22,8 @@ use OCP\IUser;
* endDate: int,
* shortMessage: string,
* message: string,
- * replacementUserId: string,
- * replacementUserDisplayName: string
+ * replacementUserId: ?string,
+ * replacementUserDisplayName: ?string
* }
*
* @since 28.0.0
@@ -76,14 +76,14 @@ interface IOutOfOfficeData extends JsonSerializable {
*
* @since 30.0.0
*/
- public function getReplacementUserId(): string;
+ public function getReplacementUserId(): ?string;
/**
* Get the replacement user displayName for auto responders and similar
*
* @since 30.0.0
*/
- public function getReplacementUserDisplayName(): string;
+ public function getReplacementUserDisplayName(): ?string;
/**
* @return OutOfOfficeData