diff options
author | Joas Schilling <coding@schilljs.com> | 2025-02-25 06:10:20 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2025-02-25 06:10:20 +0100 |
commit | 8dd81bf85aa15031c8adf7a77b5e8c05503f3d66 (patch) | |
tree | f0e0f2605d19f46f511ec4f9da303ee1937f8cc9 | |
parent | 85dc05deda4fcf4f863c158242cee9a06580e49b (diff) | |
download | nextcloud-server-feat/noid/allow-specifying-related-object.tar.gz nextcloud-server-feat/noid/allow-specifying-related-object.zip |
fixup! feat(talk): Allow apps to specify a related objectfeat/noid/allow-specifying-related-object
-rw-r--r-- | lib/private/Talk/ConversationOptions.php | 16 | ||||
-rw-r--r-- | lib/public/Talk/IConversationOptions.php | 11 |
2 files changed, 18 insertions, 9 deletions
diff --git a/lib/private/Talk/ConversationOptions.php b/lib/private/Talk/ConversationOptions.php index f1a9f09fd63..e284f56b14b 100644 --- a/lib/private/Talk/ConversationOptions.php +++ b/lib/private/Talk/ConversationOptions.php @@ -15,13 +15,13 @@ class ConversationOptions implements IConversationOptions { private function __construct( private bool $isPublic, - private string $objectType, - private string $objectId, + private ?string $objectType = null, + private ?string $objectId = null, ) { } public static function default(): self { - return new self(false, '', ''); + return new self(false); } public function setPublic(bool $isPublic = true): IConversationOptions { @@ -33,15 +33,21 @@ class ConversationOptions implements IConversationOptions { return $this->isPublic; } - public function getObjectType(): string { + public function getObjectType(): ?string { return $this->objectType; } - public function getObjectId(): string { + public function getObjectId(): ?string { return $this->objectId; } + /** + */ public function setObject(string $objectType, string $objectId): self { + if ($objectType === '' || $objectId === '') { + throw new \InvalidArgumentException(); + } + $this->objectType = $objectType; $this->objectId = $objectId; return $this; diff --git a/lib/public/Talk/IConversationOptions.php b/lib/public/Talk/IConversationOptions.php index 0b9d338c096..ad8a2a0d4cc 100644 --- a/lib/public/Talk/IConversationOptions.php +++ b/lib/public/Talk/IConversationOptions.php @@ -34,23 +34,26 @@ interface IConversationOptions { /** * Object type this conversation is related to * - * @return string + * @return ?non-empty-string * @since 31.0.1 */ - public function getObjectType(): string; + public function getObjectType(): ?string; /** * Object ID this conversation is related to * - * @return string + * @return ?non-empty-string * @since 31.0.1 */ - public function getObjectId(): string; + public function getObjectId(): ?string; /** * Give a reference to an object this conversation is related to * + * @param non-empty-string $objectType + * @param non-empty-string $objectId * @return $this + * @throws \InvalidArgumentException When either parameter is empty * @since 31.0.1 */ public function setObject(string $objectType, string $objectId): self; |