diff --git a/lib/Controller/BanController.php b/lib/Controller/BanController.php index 43cf0bca13..0ed29b5ec4 100644 --- a/lib/Controller/BanController.php +++ b/lib/Controller/BanController.php @@ -41,7 +41,7 @@ class BanController extends AEnvironmentAwareController { * @param 'users'|'groups'|'circles'|'emails'|'federated_users'|'phones'|'ip' $actorType Type of actor to ban, or `ip` when banning a clients remote address * @psalm-param Attendee::ACTOR_*|'ip' $actorType Type of actor to ban, or `ip` when banning a clients remote address * @param string $actorId Actor ID or the IP address or range in case of type `ip` - * @param string $internalNote Optional internal note + * @param string $internalNote Optional internal note (max. 4000 characters) * @return DataResponse|DataResponse * * 200: Ban successfully diff --git a/lib/Model/Ban.php b/lib/Model/Ban.php index b2f1d686d4..52785731aa 100644 --- a/lib/Model/Ban.php +++ b/lib/Model/Ban.php @@ -32,6 +32,8 @@ use OCP\AppFramework\Db\Entity; * @method null|string getInternalNote() */ class Ban extends Entity implements \JsonSerializable { + public const NOTE_MAX_LENGTH = 4000; + protected string $actorType = ''; protected string $actorId = ''; protected int $roomId = 0; diff --git a/lib/Service/BanService.php b/lib/Service/BanService.php index 5d8495db3b..0be4edf765 100644 --- a/lib/Service/BanService.php +++ b/lib/Service/BanService.php @@ -33,7 +33,7 @@ class BanService { throw new \InvalidArgumentException('bannedActor'); } - if (empty($internalNote)) { + if (strlen($internalNote) > Ban::NOTE_MAX_LENGTH) { throw new \InvalidArgumentException('internalNote'); } diff --git a/openapi-full.json b/openapi-full.json index f9f21adc89..32f12e5576 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -2003,7 +2003,7 @@ { "name": "internalNote", "in": "query", - "description": "Optional internal note", + "description": "Optional internal note (max. 4000 characters)", "schema": { "type": "string", "default": "" diff --git a/openapi.json b/openapi.json index d70cb5769d..1ec339fbfd 100644 --- a/openapi.json +++ b/openapi.json @@ -1890,7 +1890,7 @@ { "name": "internalNote", "in": "query", - "description": "Optional internal note", + "description": "Optional internal note (max. 4000 characters)", "schema": { "type": "string", "default": "" diff --git a/src/types/openapi/openapi-full.ts b/src/types/openapi/openapi-full.ts index 43e07580a2..291fe88ee8 100644 --- a/src/types/openapi/openapi-full.ts +++ b/src/types/openapi/openapi-full.ts @@ -2389,7 +2389,7 @@ export interface operations { actorType: "users" | "groups" | "circles" | "emails" | "federated_users" | "phones" | "ip"; /** @description Actor ID or the IP address or range in case of type `ip` */ actorId: string; - /** @description Optional internal note */ + /** @description Optional internal note (max. 4000 characters) */ internalNote?: string; }; header: { diff --git a/src/types/openapi/openapi.ts b/src/types/openapi/openapi.ts index 1487919d2c..64cb4fd387 100644 --- a/src/types/openapi/openapi.ts +++ b/src/types/openapi/openapi.ts @@ -1874,7 +1874,7 @@ export interface operations { actorType: "users" | "groups" | "circles" | "emails" | "federated_users" | "phones" | "ip"; /** @description Actor ID or the IP address or range in case of type `ip` */ actorId: string; - /** @description Optional internal note */ + /** @description Optional internal note (max. 4000 characters) */ internalNote?: string; }; header: {