mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-17 21:12:20 +01:00
fix(ban): Allow empty internal note as it's optional
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
7b7c2895ad
commit
31c5347f17
7 changed files with 8 additions and 6 deletions
|
|
@ -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<Http::STATUS_OK, TalkBan, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{error: 'bannedActor'|'internalNote'}, array{}>
|
||||
*
|
||||
* 200: Ban successfully
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class BanService {
|
|||
throw new \InvalidArgumentException('bannedActor');
|
||||
}
|
||||
|
||||
if (empty($internalNote)) {
|
||||
if (strlen($internalNote) > Ban::NOTE_MAX_LENGTH) {
|
||||
throw new \InvalidArgumentException('internalNote');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2003,7 +2003,7 @@
|
|||
{
|
||||
"name": "internalNote",
|
||||
"in": "query",
|
||||
"description": "Optional internal note",
|
||||
"description": "Optional internal note (max. 4000 characters)",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
|
|
|
|||
|
|
@ -1890,7 +1890,7 @@
|
|||
{
|
||||
"name": "internalNote",
|
||||
"in": "query",
|
||||
"description": "Optional internal note",
|
||||
"description": "Optional internal note (max. 4000 characters)",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue