unread notifs
This commit is contained in:
@@ -10,7 +10,7 @@ import logging
|
||||
import sys
|
||||
import time
|
||||
from forms import CompanySettingsForm
|
||||
from utils import log_event, create_notification
|
||||
from utils import log_event, create_notification, get_unread_count
|
||||
|
||||
# Set up logging to show in console
|
||||
logging.basicConfig(
|
||||
@@ -28,6 +28,13 @@ def init_routes(main_bp):
|
||||
site_settings = SiteSettings.query.first()
|
||||
return dict(site_settings=site_settings)
|
||||
|
||||
@main_bp.context_processor
|
||||
def inject_unread_notifications():
|
||||
if current_user.is_authenticated:
|
||||
unread_count = get_unread_count(current_user.id)
|
||||
return {'unread_notifications': unread_count}
|
||||
return {'unread_notifications': 0}
|
||||
|
||||
@main_bp.route('/')
|
||||
@login_required
|
||||
@require_password_change
|
||||
|
||||
Reference in New Issue
Block a user