Feature: Outreach-Log — Mail-Inhalt per Klick anzeigen, SW by-v585
This commit is contained in:
parent
8bdd67573e
commit
775cda9a67
4 changed files with 30 additions and 6 deletions
|
|
@ -87,7 +87,7 @@ def _imap_save_sent(msg_bytes: bytes, account: str):
|
||||||
def _build_message(to: str, subject: str, body: str, account: str, html: str = None) -> MIMEMultipart:
|
def _build_message(to: str, subject: str, body: str, account: str, html: str = None) -> MIMEMultipart:
|
||||||
acc = _ACCOUNTS.get(account) or _ACCOUNTS["partner"]
|
acc = _ACCOUNTS.get(account) or _ACCOUNTS["partner"]
|
||||||
msg = MIMEMultipart("alternative")
|
msg = MIMEMultipart("alternative")
|
||||||
msg["Date"] = formatdate(localtime=True)
|
msg["Date"] = formatdate(localtime=False) # UTC explizit, Container hat keine lokale TZ
|
||||||
msg["Subject"] = subject
|
msg["Subject"] = subject
|
||||||
msg["From"] = formataddr((acc["name"], acc["from"]))
|
msg["From"] = formataddr((acc["name"], acc["from"]))
|
||||||
msg["To"] = to
|
msg["To"] = to
|
||||||
|
|
@ -267,7 +267,7 @@ def send_support_mail(to: str, subject: str, body: str):
|
||||||
def outreach_log_endpoint(user=Depends(require_admin)):
|
def outreach_log_endpoint(user=Depends(require_admin)):
|
||||||
with db() as conn:
|
with db() as conn:
|
||||||
rows = conn.execute(
|
rows = conn.execute(
|
||||||
"""SELECT ol.id, ol.recipient, ol.subject, ol.sent_at,
|
"""SELECT ol.id, ol.recipient, ol.subject, ol.body, ol.sent_at,
|
||||||
ol.from_account, u.name AS sent_by_name
|
ol.from_account, u.name AS sent_by_name
|
||||||
FROM outreach_log ol
|
FROM outreach_log ol
|
||||||
JOIN users u ON u.id = ol.sent_by
|
JOIN users u ON u.id = ol.sent_by
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '584'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '585'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
const APP_VERSION = '1.2.1'; // ← semantische Version, wird bei make release gesetzt
|
const APP_VERSION = '1.2.1'; // ← semantische Version, wird bei make release gesetzt
|
||||||
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2134,8 +2134,10 @@ window.Page_admin = (() => {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
${log.map(l => `
|
${log.map((l, i) => `
|
||||||
<tr style="border-bottom:1px solid var(--c-border)">
|
<tr data-log-idx="${i}" style="border-bottom:1px solid var(--c-border);cursor:pointer"
|
||||||
|
onmouseover="this.style.background='var(--c-surface-2)'"
|
||||||
|
onmouseout="this.style.background=''">
|
||||||
<td style="padding:var(--space-2)">${accountBadge(l.from_account)}</td>
|
<td style="padding:var(--space-2)">${accountBadge(l.from_account)}</td>
|
||||||
<td style="padding:var(--space-2)">${_esc(l.recipient)}</td>
|
<td style="padding:var(--space-2)">${_esc(l.recipient)}</td>
|
||||||
<td style="padding:var(--space-2);color:var(--c-text-secondary)">${_esc(l.subject)}</td>
|
<td style="padding:var(--space-2);color:var(--c-text-secondary)">${_esc(l.subject)}</td>
|
||||||
|
|
@ -2149,6 +2151,28 @@ window.Page_admin = (() => {
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
// Log-Zeile: Mail-Inhalt anzeigen
|
||||||
|
el.querySelectorAll('tr[data-log-idx]').forEach(row => {
|
||||||
|
row.addEventListener('click', () => {
|
||||||
|
const l = log[Number(row.dataset.logIdx)];
|
||||||
|
if (!l) return;
|
||||||
|
UI.modal({
|
||||||
|
title: _esc(l.subject),
|
||||||
|
body: `
|
||||||
|
<div style="margin-bottom:var(--space-3);font-size:var(--text-sm);color:var(--c-text-muted)">
|
||||||
|
<strong>An:</strong> ${_esc(l.recipient)} ·
|
||||||
|
<strong>Von:</strong> ${_esc(l.from_account)}@banyaro.app ·
|
||||||
|
${(l.sent_at||'').slice(0,16).replace('T',' ')}
|
||||||
|
</div>
|
||||||
|
<pre style="white-space:pre-wrap;font-family:inherit;font-size:var(--text-sm);
|
||||||
|
background:var(--c-surface-2);border-radius:var(--radius-md);
|
||||||
|
padding:var(--space-3);max-height:60vh;overflow-y:auto;
|
||||||
|
color:var(--c-text)">${_esc(l.body || '(kein Text gespeichert)')}</pre>`,
|
||||||
|
footer: `<button class="btn btn-secondary" onclick="UI.closeModal()">Schließen</button>`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Vorlage in Compose laden
|
// Vorlage in Compose laden
|
||||||
function _loadTplIntoCompose(id) {
|
function _loadTplIntoCompose(id) {
|
||||||
const tpl = templates.find(t => t.id === id);
|
const tpl = templates.find(t => t.id === id);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Offline-Cache + Push Notifications + Tile-Cache
|
Offline-Cache + Push Notifications + Tile-Cache
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const CACHE_VERSION = 'by-v584';
|
const CACHE_VERSION = 'by-v585';
|
||||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||||
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue