From 4af3b96746cf18de299dc1fd7f7d54b981ec764e Mon Sep 17 00:00:00 2001 From: jaina heartles Date: Wed, 6 Mar 2024 17:24:35 -0800 Subject: [PATCH] Increase bio char limit --- .../migration/1709773838671-increaseBioLimit.js | 13 +++++++++++++ .../src/core/activitypub/models/ApPersonService.ts | 2 +- packages/backend/src/models/User.ts | 2 +- packages/backend/src/models/UserProfile.ts | 4 ++-- 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 packages/backend/migration/1709773838671-increaseBioLimit.js diff --git a/packages/backend/migration/1709773838671-increaseBioLimit.js b/packages/backend/migration/1709773838671-increaseBioLimit.js new file mode 100644 index 000000000..0c9b1c07f --- /dev/null +++ b/packages/backend/migration/1709773838671-increaseBioLimit.js @@ -0,0 +1,13 @@ + +export class IncreaseBioLimit1709773838671 { + name = "IncreaseBioLimit1709773838671"; + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE user_profile ALTER COLUMN description TYPE text;`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE user_profile ALTER COLUMN description TYPE varchar(2048) USING left(description, 2048);`); + } + +} diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index c489d38d9..417351c4a 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -51,7 +51,7 @@ import type { ApImageService } from './ApImageService.js'; import type { IActor, IObject } from '../type.js'; const nameLength = 128; -const summaryLength = 2048; +const summaryLength = 65536; type Field = Record<'name' | 'value', string>; diff --git a/packages/backend/src/models/User.ts b/packages/backend/src/models/User.ts index b0910133c..0a8fb7030 100644 --- a/packages/backend/src/models/User.ts +++ b/packages/backend/src/models/User.ts @@ -339,7 +339,7 @@ export type MiPartialRemoteUser = Partial & { export const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const; export const passwordSchema = { type: 'string', minLength: 1 } as const; export const nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const; -export const descriptionSchema = { type: 'string', minLength: 1, maxLength: 1500 } as const; +export const descriptionSchema = { type: 'string', minLength: 1, maxLength: 20000 } as const; export const locationSchema = { type: 'string', minLength: 1, maxLength: 50 } as const; export const listenbrainzSchema = { type: "string", minLength: 1, maxLength: 128 } as const; export const birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.toString().slice(1, -1) } as const; diff --git a/packages/backend/src/models/UserProfile.ts b/packages/backend/src/models/UserProfile.ts index 40ea26f61..c4f6a16e2 100644 --- a/packages/backend/src/models/UserProfile.ts +++ b/packages/backend/src/models/UserProfile.ts @@ -43,8 +43,8 @@ export class MiUserProfile { }) public listenbrainz: string | null; - @Column('varchar', { - length: 2048, nullable: true, + @Column('text', { + nullable: true, comment: 'The description (bio) of the User.', }) public description: string | null;