Bugfix, Avatar upload message "avatar-too-big" shows now the configured max filesize

This commit is contained in:
Martin Filser 2023-03-12 21:58:04 +01:00
parent 07926386ea
commit 7de50c0f4b
3 changed files with 6 additions and 3 deletions

View file

@ -134,7 +134,7 @@
"attachmentDeletePopup-title": "Anhang löschen?",
"attachments": "Anhänge",
"auto-watch": "Neue Boards nach Erstellung automatisch beobachten",
"avatar-too-big": "Das Profilbild ist zu groß (520KB max)",
"avatar-too-big": "Das Profilbild ist zu groß (__size__ max)",
"back": "Zurück",
"board-change-color": "Farbe ändern",
"show-at-all-boards-page": "Zeige auf \"Alle Boards\" Seite",

View file

@ -134,7 +134,7 @@
"attachmentDeletePopup-title": "Delete Attachment?",
"attachments": "Attachments",
"auto-watch": "Automatically watch boards when they are created",
"avatar-too-big": "The avatar is too large (520KB max)",
"avatar-too-big": "The avatar is too large (__size__ max)",
"back": "Back",
"board-change-color": "Change color",
"show-at-all-boards-page" : "Show at All Boards page",

View file

@ -3,10 +3,13 @@ import { FilesCollection } from 'meteor/ostrio:files';
import { formatFleURL } from 'meteor/ostrio:files/lib';
import { isFileValid } from './fileValidation';
import { createBucket } from './lib/grid/createBucket';
import { TAPi18n } from '/imports/i18n';
import fs from 'fs';
import path from 'path';
import FileStoreStrategyFactory, { FileStoreStrategyFilesystem, FileStoreStrategyGridFs, STORAGE_NAME_FILESYSTEM } from '/models/lib/fileStoreStrategy';
const filesize = require('filesize');
let avatarsUploadExternalProgram;
let avatarsUploadMimeTypes = [];
let avatarsUploadSize = 72000;
@ -84,7 +87,7 @@ Avatars = new FilesCollection({
if (file.size <= avatarsUploadSize && file.type.startsWith('image/')) {
return true;
}
return 'avatar-too-big';
return TAPi18n.__('avatar-too-big', {size: filesize(avatarsUploadSize)});
},
onAfterUpload(fileObj) {
// current storage is the filesystem, update object and database