From 81dfc1bfcb30996c4ce1932dfefc814d4bad217c Mon Sep 17 00:00:00 2001 From: KevinWh0 <45321184+KevinWh0@users.noreply.github.com> Date: Tue, 27 Feb 2024 01:05:10 +0100 Subject: [PATCH] Cleaning up some old comments --- .../src/components/MkDriveFileThumbnail.vue | 59 +++++++++++++++---- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/packages/frontend/src/components/MkDriveFileThumbnail.vue b/packages/frontend/src/components/MkDriveFileThumbnail.vue index 2f1fef4ea6..a2bf68691d 100644 --- a/packages/frontend/src/components/MkDriveFileThumbnail.vue +++ b/packages/frontend/src/components/MkDriveFileThumbnail.vue @@ -5,17 +5,25 @@ SPDX-License-Identifier: AGPL-3.0-only @@ -56,6 +64,20 @@ const isThumbnailAvailable = computed(() => { ? (is.value === 'image' as const || is.value === 'video') : false; }); + +const getTrimmedAltText = () => { + if (props.file.comment == null) { + return ''; + } + const maxCharacters = 40; + + const alt = props.file.comment as unknown as string; + if (alt.length > maxCharacters) { + return alt.substring(0, maxCharacters) + '...'; + } + + return alt; +};