Fix issues #6, #7, #11, #12, #13: med reminders, push notifications, auth persistence, scheduling conflicts
- Fix TIME object vs string comparison in scheduler preventing adaptive med reminders from ever firing (#12, #6) - Add frequency filtering to midnight schedule creation for every_n_days meds - Require start_date and interval_days for every_n_days medications - Add refresh token support (30-day) to API and bot for persistent sessions (#13) - Add "trusted device" checkbox to frontend login for long-lived sessions (#7) - Auto-refresh expired tokens in both bot (apiRequest) and frontend (api.ts) - Restore bot sessions from cache on restart using refresh tokens - Duration-aware routine scheduling conflict detection (#11) - Add conflict check when starting routine sessions against medication times - Add diagnostic logging to notification delivery channels Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,18 +18,27 @@ logger = logging.getLogger(__name__)
|
||||
def _sendToEnabledChannels(notif_settings, message, user_uuid=None):
|
||||
"""Send message to all enabled channels. Returns True if at least one succeeded."""
|
||||
sent = False
|
||||
logger.info(f"Sending notification to user {user_uuid}: {message[:80]}")
|
||||
|
||||
if notif_settings.get("discord_enabled") and notif_settings.get("discord_user_id"):
|
||||
if discord.send_dm(notif_settings["discord_user_id"], message):
|
||||
logger.debug(f"Discord DM sent to {notif_settings['discord_user_id']}")
|
||||
sent = True
|
||||
|
||||
if notif_settings.get("ntfy_enabled") and notif_settings.get("ntfy_topic"):
|
||||
if ntfy.send(notif_settings["ntfy_topic"], message):
|
||||
logger.debug(f"ntfy sent to topic {notif_settings['ntfy_topic']}")
|
||||
sent = True
|
||||
|
||||
if notif_settings.get("web_push_enabled") and user_uuid:
|
||||
if web_push.send_to_user(user_uuid, message):
|
||||
logger.debug(f"Web push sent for user {user_uuid}")
|
||||
sent = True
|
||||
else:
|
||||
logger.warning(f"Web push failed or no subscriptions for user {user_uuid}")
|
||||
|
||||
if not sent:
|
||||
logger.warning(f"No notification channels succeeded for user {user_uuid}")
|
||||
|
||||
return sent
|
||||
|
||||
|
||||
Reference in New Issue
Block a user