Files
devplacepy/devplacepy/templates/admin_notifications.html
T
retoor e0e64c8d9e feat: add telegram notification channel with outbox service and per-user preferences
Extend the notification system with a third channel (telegram) alongside existing in_app and push channels. Add `telegram_enabled` column to `notification_preferences` table, update `NOTIFICATION_CHANNELS` and `_NOTIFICATION_CHANNEL_COLUMNS` mappings, and set telegram default to off (`_NOTIFICATION_CHANNEL_DEFAULTS`). Create `telegram_outbox` table with columns for uid, user_uid, chat_id, text, status, attempts, created_at, and sent_at, plus an index on status/id for efficient polling. Register `TelegramOutboxService` in the service manager lifecycle. Update API documentation strings to describe the new channel and its pairing requirement. Extend admin notification defaults view to include telegram column. Pass `notif_telegram_paired` flag to profile template based on `telegram_store.is_paired()` check. Update `NotificationPrefForm` and `NotificationDefaultForm` model literals to accept "telegram" as a valid channel value.
2026-06-22 20:52:02 +00:00

56 lines
2.7 KiB
HTML

{% extends "admin_base.html" %}
{% block extra_head %}{{ super() }}
<link rel="stylesheet" href="{{ static_url('/static/css/profile.css') }}">
{% endblock %}
{% block admin_content %}
<div class="admin-toolbar">
<h2>Notification defaults</h2>
</div>
<div class="notif-prefs" data-admin-notif>
<div class="notif-prefs-intro">
<p>These are the platform-wide defaults applied to every user who has not customized a notification on their own profile. Changing a default does not override a user's explicit choice. Telegram delivery only reaches users who paired their Telegram account.</p>
</div>
<div class="notif-prefs-scroll">
<table class="notif-prefs-table">
<caption class="sr-only">Platform-wide default notification channels per notification type</caption>
<thead>
<tr>
<th scope="col">Notification</th>
<th scope="col" class="notif-prefs-col">In-app</th>
<th scope="col" class="notif-prefs-col">Push</th>
<th scope="col" class="notif-prefs-col">Telegram</th>
</tr>
</thead>
<tbody>
{% for pref in notification_defaults %}
<tr>
<td>
<span class="notif-prefs-label">{{ pref.label }}</span>
<span class="notif-prefs-desc">{{ pref.description }}</span>
</td>
<td class="notif-prefs-col">
<label class="notif-switch">
<input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="in_app" {% if pref.in_app %}checked{% endif %} aria-label="In-app default for {{ pref.label }}">
<span class="notif-switch-track"></span>
</label>
</td>
<td class="notif-prefs-col">
<label class="notif-switch">
<input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="push" {% if pref.push %}checked{% endif %} aria-label="Push default for {{ pref.label }}">
<span class="notif-switch-track"></span>
</label>
</td>
<td class="notif-prefs-col">
<label class="notif-switch">
<input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="telegram" {% if pref.telegram %}checked{% endif %} aria-label="Telegram default for {{ pref.label }}">
<span class="notif-switch-track"></span>
</label>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}