diff options
author | Hamza Mahjoubi <hamzamahjoubi221@gmail.com> | 2024-06-10 16:30:53 +0200 |
---|---|---|
committer | Hamza Mahjoubi <hamzamahjoubi221@gmail.com> | 2024-07-01 15:10:16 +0200 |
commit | a9774741e815c02a9f5973bf6477a7c9da653732 (patch) | |
tree | 171ab358957d002bd4e13dea0d532d0c826ca51c /lib | |
parent | 3b75c5b98cd0356e99c07d9696c49732f195b3f6 (diff) | |
download | nextcloud-server-a9774741e815c02a9f5973bf6477a7c9da653732.tar.gz nextcloud-server-a9774741e815c02a9f5973bf6477a7c9da653732.zip |
Feat: Allow users to select another user as their out-of-office replacement
Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/User/AvailabilityCoordinator.php | 4 | ||||
-rw-r--r-- | lib/private/User/OutOfOfficeData.php | 14 | ||||
-rw-r--r-- | lib/public/User/IOutOfOfficeData.php | 16 |
3 files changed, 33 insertions, 1 deletions
diff --git a/lib/private/User/AvailabilityCoordinator.php b/lib/private/User/AvailabilityCoordinator.php index 5017a85c28b..988f2e55260 100644 --- a/lib/private/User/AvailabilityCoordinator.php +++ b/lib/private/User/AvailabilityCoordinator.php @@ -61,6 +61,8 @@ class AvailabilityCoordinator implements IAvailabilityCoordinator { $cachedData['endDate'], $cachedData['shortMessage'], $cachedData['message'], + $cachedData['replacementUserId'], + $cachedData['replacementUserDisplayName'], ); } @@ -72,6 +74,8 @@ class AvailabilityCoordinator implements IAvailabilityCoordinator { 'endDate' => $data->getEndDate(), 'shortMessage' => $data->getShortMessage(), 'message' => $data->getMessage(), + 'replacementUserId' => $data->getReplacementUserId(), + 'replacementUserDisplayName' => $data->getReplacementUserDisplayName(), ], JSON_THROW_ON_ERROR); } catch (JsonException $e) { $this->logger->error('Failed to serialize out-of-office data: ' . $e->getMessage(), [ diff --git a/lib/private/User/OutOfOfficeData.php b/lib/private/User/OutOfOfficeData.php index 65d7c9c24cb..2d90dbfd39c 100644 --- a/lib/private/User/OutOfOfficeData.php +++ b/lib/private/User/OutOfOfficeData.php @@ -18,7 +18,9 @@ class OutOfOfficeData implements IOutOfOfficeData { private int $startDate, private int $endDate, private string $shortMessage, - private string $message) { + private string $message, + private string $replacementUserId, + private string $replacementUserDisplayName) { } public function getId(): string { @@ -45,6 +47,14 @@ class OutOfOfficeData implements IOutOfOfficeData { return $this->message; } + public function getReplacementUserId(): string { + return $this->replacementUserId; + } + + public function getReplacementUserDisplayName(): string { + return $this->replacementUserDisplayName; + } + public function jsonSerialize(): array { return [ 'id' => $this->getId(), @@ -53,6 +63,8 @@ class OutOfOfficeData implements IOutOfOfficeData { 'endDate' => $this->getEndDate(), 'shortMessage' => $this->getShortMessage(), 'message' => $this->getMessage(), + 'replacementUserId' => $this->getReplacementUserId(), + 'replacementUserDisplayName' => $this->getReplacementUserDisplayName(), ]; } } diff --git a/lib/public/User/IOutOfOfficeData.php b/lib/public/User/IOutOfOfficeData.php index c3a5bf90184..19cc1120c4c 100644 --- a/lib/public/User/IOutOfOfficeData.php +++ b/lib/public/User/IOutOfOfficeData.php @@ -22,6 +22,8 @@ use OCP\IUser; * endDate: int, * shortMessage: string, * message: string, + * replacementUserId: string, + * replacementUserDisplayName: string * } * * @since 28.0.0 @@ -70,6 +72,20 @@ interface IOutOfOfficeData extends JsonSerializable { public function getMessage(): string; /** + * Get the replacement user id for auto responders and similar + * + * @since 30.0.0 + */ + public function getReplacementUserId(): string; + + /** + * Get the replacement user displayName for auto responders and similar + * + * @since 30.0.0 + */ + public function getReplacementUserDisplayName(): string; + + /** * @return OutOfOfficeData * * @since 28.0.0 |