From 186d693385422b256e544d5dfadacf4ce1987665 Mon Sep 17 00:00:00 2001 From: Puniko Date: Sat, 17 Sep 2022 10:48:58 +0200 Subject: [PATCH] increase image description limit to 2048 characters Changelog: Changed --- .../1663399074403-resize-comments-drive-file.js | 14 ++++++++++++++ .../src/server/api/endpoints/drive/files/update.ts | 2 +- .../api/endpoints/drive/files/upload-from-url.ts | 2 +- packages/client/src/components/media-caption.vue | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 packages/backend/migration/1663399074403-resize-comments-drive-file.js diff --git a/packages/backend/migration/1663399074403-resize-comments-drive-file.js b/packages/backend/migration/1663399074403-resize-comments-drive-file.js new file mode 100644 index 000000000..a037f1655 --- /dev/null +++ b/packages/backend/migration/1663399074403-resize-comments-drive-file.js @@ -0,0 +1,14 @@ + +export class resizeCommentsDriveFile1663399074403 { + constructor() { + this.name = 'resizeCommentsDriveFile1663399074403'; + } + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "comment" TYPE character varying(2048)`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "comment" TYPE character varying(512)`); + } +} diff --git a/packages/backend/src/server/api/endpoints/drive/files/update.ts b/packages/backend/src/server/api/endpoints/drive/files/update.ts index e6922cfaa..dedec03e2 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/update.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/update.ts @@ -52,7 +52,7 @@ export const paramDef = { folderId: { type: 'string', format: 'misskey:id', nullable: true }, name: { type: 'string' }, isSensitive: { type: 'boolean' }, - comment: { type: 'string', nullable: true, maxLength: 512 }, + comment: { type: 'string', nullable: true, maxLength: 2048 }, }, required: ['fileId'], } as const; diff --git a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts index 56f9ccbae..db2911456 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/upload-from-url.ts @@ -25,7 +25,7 @@ export const paramDef = { url: { type: 'string' }, folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, isSensitive: { type: 'boolean', default: false }, - comment: { type: 'string', nullable: true, maxLength: 512, default: null }, + comment: { type: 'string', nullable: true, maxLength: 2048, default: null }, marker: { type: 'string', nullable: true, default: null }, force: { type: 'boolean', default: false }, }, diff --git a/packages/client/src/components/media-caption.vue b/packages/client/src/components/media-caption.vue index 6cb618b3a..bb87d7ca1 100644 --- a/packages/client/src/components/media-caption.vue +++ b/packages/client/src/components/media-caption.vue @@ -104,8 +104,8 @@ function onInputKeydown(evt: KeyboardEvent): void { } const remainingLength = computed((): number => { - if (typeof inputValue !== 'string') return 512; - return 512 - length(inputValue); + if (typeof inputValue !== 'string') return 2048; + return 2048 - length(inputValue); }); onMounted(() => {