Upgrade code

This commit is contained in:
2026-03-30 14:04:58 -04:00
parent bf29ccb287
commit 53eaf1c76d
12 changed files with 390 additions and 58 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
import logging
from flask import Blueprint, jsonify, request
from flask import Blueprint, jsonify, request, abort
from flask_login import login_required, current_user
from flask_socketio import emit, join_room, leave_room
from app import db, socketio
@@ -66,7 +66,7 @@ def mark_all_read():
def get_comments(ticket_id):
"""Return all visible comments for a ticket as JSON."""
from app.models import Ticket, Comment, UserRole
ticket = Ticket.query.get_or_404(ticket_id)
ticket = db.session.get(Ticket, ticket_id) or abort(404)
# Employees may only see their own tickets
if not current_user.is_it_staff and ticket.created_by_id != current_user.id:
return jsonify({'error': 'Forbidden'}), 403
@@ -81,6 +81,7 @@ def get_comments(ticket_id):
'id' : c.id,
'author_name': c.author.full_name,
'author_init': c.author.full_name[0].upper(),
'author_avatar': c.author.avatar_url or '',
'is_it_staff': c.author.is_it_staff,
'is_internal': c.is_internal,
'body' : c.body,