From 6fe548411996ff4f43d8139ccce7e10796c82cec Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Mon, 20 Dec 2021 23:50:37 +0530 Subject: [PATCH] chore: Allow more filetypes in uploads (#3557) - Allowing the ability to upload more common file types like zip, Docx etc - Fallback for image bubble when the image URL isn't available fixes: #3270 Co-authored-by: Muhsin Keloth Co-authored-by: Nithin David <1277421+nithindavid@users.noreply.github.com> --- app/helpers/file_type_helper.rb | 31 +++++++++++++------ .../assets/scss/_foundation-settings.scss | 3 ++ .../widgets/WootWriter/ReplyBottomPanel.vue | 6 +++- .../widgets/conversation/Message.vue | 17 ++++++++-- .../widgets/conversation/bubble/Image.vue | 6 +++- .../dashboard/settings/inbox/Settings.vue | 6 +++- app/javascript/shared/constants/messages.js | 11 +++++++ .../widget/components/ChatAttachment.vue | 10 ++++-- app/models/attachment.rb | 29 ++++++++++++++--- 9 files changed, 99 insertions(+), 20 deletions(-) diff --git a/app/helpers/file_type_helper.rb b/app/helpers/file_type_helper.rb index 64d67701a..503c7f25b 100644 --- a/app/helpers/file_type_helper.rb +++ b/app/helpers/file_type_helper.rb @@ -1,16 +1,29 @@ module FileTypeHelper + # NOTE: video, audio, image, etc are filetypes previewable in frontend def file_type(content_type) - return :image if [ - 'image/jpeg', - 'image/png', - 'image/gif', - 'image/tiff', - 'image/bmp' - ].include?(content_type) - - return :video if content_type.include?('video/') + return :image if image_file?(content_type) + return :video if video_file?(content_type) return :audio if content_type.include?('audio/') :file end + + def image_file?(content_type) + [ + 'image/jpeg', + 'image/png', + 'image/gif', + 'image/bmp', + 'image/webp' + ].include?(content_type) + end + + def video_file?(content_type) + [ + 'video/ogg', + 'video/mp4', + 'video/webm', + 'video/quicktime' + ].include?(content_type) + end end diff --git a/app/javascript/dashboard/assets/scss/_foundation-settings.scss b/app/javascript/dashboard/assets/scss/_foundation-settings.scss index 13b7dfafd..c6b7f6fd3 100644 --- a/app/javascript/dashboard/assets/scss/_foundation-settings.scss +++ b/app/javascript/dashboard/assets/scss/_foundation-settings.scss @@ -45,6 +45,9 @@ // 1. Global // --------- +// Disable contrast warnings in Foundation. +$contrast-warnings: false; + $global-font-size: 10px; $global-width: 100%; $global-lineheight: 1.5; diff --git a/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue b/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue index 5b47648d1..594aaa6aa 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue @@ -15,7 +15,7 @@