From 6e790677b4897dd8ac253f6364c32c1c3b2b6fa5 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Wed, 2 Aug 2023 23:30:12 +0200 Subject: [PATCH] Improving e-mail design #683 --- src/backend/model/mediamessengers/EmailMediaMessenger.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/model/mediamessengers/EmailMediaMessenger.ts b/src/backend/model/mediamessengers/EmailMediaMessenger.ts index 1704161f..921af322 100644 --- a/src/backend/model/mediamessengers/EmailMediaMessenger.ts +++ b/src/backend/model/mediamessengers/EmailMediaMessenger.ts @@ -57,6 +57,7 @@ export class EmailMediaMessenger { ' \n' + ''; let htmlMiddle = ''; + const numberOfColumns = media.length >= 6 ? 3 : 2; for (let i = 0; i < media.length; ++i) { const thPath = await this.getThumbnail(media[i]); const linkUrl = Utils.concatUrls(Config.Server.publicUrl, '/gallery/', encodeURIComponent(path.join(media[i].directory.path, media[i].directory.name))) + @@ -71,15 +72,15 @@ export class EmailMediaMessenger { path: thPath, cid: 'img' + i }); - if (i % 2 == 0) { + if (i % numberOfColumns == 0) { htmlMiddle += ''; } htmlMiddle += '\n' + - ' ' + media[i].name + '\n' + + ' ' + media[i].name + '\n' + caption + ' \n'; - if (i % 2 == 1 || i === media.length - 1) { + if (i % numberOfColumns == (numberOfColumns - 1) || i === media.length - 1) { htmlMiddle += ''; } }