From cb0b7b58bb9d0174a904e0b9c6462127421d691b Mon Sep 17 00:00:00 2001 From: Zaidhaan Date: Mon, 6 Mar 2023 21:12:31 +0800 Subject: [PATCH] fix: disallow media description exceeding limits (#1854) --- components/publish/PublishAttachment.vue | 8 +++++++- components/publish/PublishCharacterCounter.vue | 12 ++++++++++++ components/publish/PublishWidget.vue | 12 +++++++----- 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 components/publish/PublishCharacterCounter.vue diff --git a/components/publish/PublishAttachment.vue b/components/publish/PublishAttachment.vue index 89aea8e9..e70ffe9c 100644 --- a/components/publish/PublishAttachment.vue +++ b/components/publish/PublishAttachment.vue @@ -15,6 +15,9 @@ const emit = defineEmits<{ (evt: 'setDescription', description: string): void }>() +// from https://github.com/mastodon/mastodon/blob/dfa984/app/models/media_attachment.rb#L40 +const maxDescriptionLength = 1500 + const isEditDialogOpen = ref(false) const description = ref(props.attachment.description ?? '') const toggleApply = () => { @@ -55,7 +58,10 @@ const toggleApply = () => {