unread notifs
This commit is contained in:
@@ -22,14 +22,14 @@ to maintain file metadata and content.
|
||||
from flask import Blueprint, jsonify, request, abort, send_from_directory, send_file
|
||||
from flask_login import login_required, current_user
|
||||
import os
|
||||
from models import Room, RoomMemberPermission, RoomFile, TrashedFile, db
|
||||
from models import Room, RoomMemberPermission, RoomFile, TrashedFile, db, User, Notif
|
||||
from werkzeug.utils import secure_filename, safe_join
|
||||
import time
|
||||
import shutil
|
||||
import io
|
||||
import zipfile
|
||||
from datetime import datetime
|
||||
from utils import log_event
|
||||
from utils import log_event, create_notification, get_unread_count
|
||||
|
||||
# Blueprint for room file operations
|
||||
room_files_bp = Blueprint('room_files', __name__, url_prefix='/api/rooms')
|
||||
@@ -61,6 +61,13 @@ ALLOWED_EXTENSIONS = {
|
||||
'eml', 'msg', 'vcf', 'ics'
|
||||
}
|
||||
|
||||
@room_files_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}
|
||||
|
||||
def get_room_dir(room_id):
|
||||
"""
|
||||
Get the absolute path to a room's directory.
|
||||
|
||||
Reference in New Issue
Block a user