diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-12-01 10:46:16 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-12-05 08:36:50 +0100 |
commit | 9a206c6282a55c9fdeb99abe8684199c0f934d7f (patch) | |
tree | afbcabe90d48f80bf26284651bbbfceba806bb4e /lib | |
parent | e27e2e43955bc09bbce86b4cfe458a2af2f66724 (diff) | |
download | nextcloud-server-9a206c6282a55c9fdeb99abe8684199c0f934d7f.tar.gz nextcloud-server-9a206c6282a55c9fdeb99abe8684199c0f934d7f.zip |
fix(dav): Make current ooo info time-dependent
* If there is an out of office absence info and it happens now -> return
data
* Else: return no data
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/User/OutOfOfficeData.php | 11 | ||||
-rw-r--r-- | lib/public/User/IOutOfOfficeData.php | 19 |
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/private/User/OutOfOfficeData.php b/lib/private/User/OutOfOfficeData.php index 12b7e03a0ae..72e42afab6a 100644 --- a/lib/private/User/OutOfOfficeData.php +++ b/lib/private/User/OutOfOfficeData.php @@ -60,4 +60,15 @@ class OutOfOfficeData implements IOutOfOfficeData { public function getMessage(): string { return $this->message; } + + public function jsonSerialize(): array { + return [ + 'id' => $this->getId(), + 'userId' => $this->getUser()->getUID(), + 'startDate' => $this->getStartDate(), + 'endDate' => $this->getEndDate(), + 'shortMessage' => $this->getShortMessage(), + 'message' => $this->getMessage(), + ]; + } } diff --git a/lib/public/User/IOutOfOfficeData.php b/lib/public/User/IOutOfOfficeData.php index 03444449d58..31281104382 100644 --- a/lib/public/User/IOutOfOfficeData.php +++ b/lib/public/User/IOutOfOfficeData.php @@ -25,14 +25,24 @@ declare(strict_types=1); namespace OCP\User; +use JsonSerializable; use OCP\IUser; /** * DTO to hold out-of-office information of a user * + * @psalm-type OutOfOfficeData = array{ + * id: string, + * userId: string, + * startDate: int, + * endDate: int, + * shortMessage: string, + * message: string, + * } + * * @since 28.0.0 */ -interface IOutOfOfficeData { +interface IOutOfOfficeData extends JsonSerializable { /** * Get the unique token assigned to the current out-of-office event * @@ -74,4 +84,11 @@ interface IOutOfOfficeData { * @since 28.0.0 */ public function getMessage(): string; + + /** + * @return OutOfOfficeData + * + * @since 28.0.0 + */ + public function jsonSerialize(): array; } |