mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 07:30:04 +00:00
feat(files): FILE_UPLOAD_LIMIT_MB sets the upload limit for files and notes
The 50 MB limit for files, booking attachments and note attachments becomes FILE_UPLOAD_LIMIT_MB, 50 by default. The server hands it to the client through the app config, so the upload dialogs refuse a file over it up front and say what the limit is; on desktop a file over it no longer vanishes without a word. (#1364)
This commit is contained in:
@@ -43,6 +43,7 @@ export function useFileManager({ files = [], onUpload, onDelete, onUpdate, place
|
||||
const can = useCanDo()
|
||||
const trip = useTripStore((s) => s.trip)
|
||||
const currentUser = useAuthStore((s) => s.user)
|
||||
const maxUploadMb = useAuthStore((s) => s.maxUploadMb)
|
||||
const canManageSync = canManageDocSync(currentUser, trip)
|
||||
const docSyncOffered = useDocSyncOffered(tripId, canManageSync)
|
||||
const { t, locale } = useTranslation()
|
||||
@@ -137,7 +138,13 @@ export function useFileManager({ files = [], onUpload, onDelete, onUpdate, place
|
||||
|
||||
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
||||
onDrop,
|
||||
maxSize: 50 * 1024 * 1024,
|
||||
maxSize: maxUploadMb * 1024 * 1024,
|
||||
// A file over the limit used to vanish without a word; say why it was left out.
|
||||
onDropRejected: rejections => {
|
||||
if (rejections.some(r => r.errors.some(e => e.code === 'file-too-large'))) {
|
||||
toast.error(t('files.uploadErrorSize', { max: maxUploadMb }))
|
||||
}
|
||||
},
|
||||
noClick: false,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user