Antwort-Mails: hinterlegte Anlagen mitschicken (Standard: keine)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-06 11:48:39 +02:00
co-authored by Claude Opus 4.8
parent c2c51f9fca
commit 7dddbe18b1
2 changed files with 28 additions and 0 deletions
+13
View File
@@ -1389,6 +1389,19 @@ initializeDatabase().then(() => {
attNames.push(a.dateiname); attNames.push(a.dateiname);
} }
// Selected static attachments (Zeugnisse etc.), e.g. from a reply form.
// Default: none selected.
let basisAnlageIds = req.body.basis_anlage || [];
if (!Array.isArray(basisAnlageIds)) basisAnlageIds = [basisAnlageIds];
for (const bid of basisAnlageIds) {
const ba = await dbGet('SELECT * FROM basis_anhaenge WHERE id = ?', [bid]);
if (!ba) continue;
const p = path.join(basisAnhaengeDir, ba.pfad);
if (!fs.existsSync(p)) continue;
attachments.push({ filename: ba.dateiname, path: p, contentType: ba.mime || undefined });
attNames.push(ba.dateiname);
}
// Threading headers when this is a reply to a stored message. // Threading headers when this is a reply to a stored message.
let inReplyTo = null, references = null; let inReplyTo = null, references = null;
if (req.body.reply_to) { if (req.body.reply_to) {
+15
View File
@@ -385,6 +385,21 @@
</div> </div>
<textarea name="body" rows="12" required <textarea name="body" rows="12" required
class="reply-body w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-800 dark:text-white text-sm leading-relaxed"><%= e.reply_quote ? '\n\n' + e.reply_quote : '' %></textarea> class="reply-body w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-800 dark:text-white text-sm leading-relaxed"><%= e.reply_quote ? '\n\n' + e.reply_quote : '' %></textarea>
<% if (basisAnhaenge && basisAnhaenge.length) { %>
<p class="text-xs font-medium text-gray-500 dark:text-gray-400 mt-2 mb-1">Anlagen</p>
<div class="space-y-1">
<% basisAnhaenge.forEach(function(ba){ %>
<label class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-200">
<input type="checkbox" name="basis_anlage" value="<%= ba.id %>"
class="rounded border-gray-300 dark:border-gray-600 text-blue-600">
<%= ba.name || ba.dateiname %>
<% if (ba.name && ba.dateiname && ba.name !== ba.dateiname) { %>
<span class="text-xs text-gray-400">(<%= ba.dateiname %>)</span>
<% } %>
</label>
<% }); %>
</div>
<% } %>
<div class="flex justify-end mt-2"> <div class="flex justify-end mt-2">
<button type="submit" class="inline-flex items-center gap-1.5 px-4 py-2 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors">Antwort senden</button> <button type="submit" class="inline-flex items-center gap-1.5 px-4 py-2 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors">Antwort senden</button>
</div> </div>