fix: restore historical order visibility for HartOMat admins
This commit is contained in:
@@ -9,6 +9,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy import select, func, update, or_, and_
|
||||
|
||||
from app.database import get_db
|
||||
from app.domains.auth.models import PM_ROLES
|
||||
from app.models.audit_log import AuditLog
|
||||
from app.models.user import User
|
||||
from app.utils.auth import get_current_user
|
||||
@@ -45,7 +46,7 @@ class MarkReadRequest(BaseModel):
|
||||
def _visibility_filter(user: User):
|
||||
"""Rows visible to this user: targeted at them, or broadcast (null) if admin/PM."""
|
||||
targeted = AuditLog.target_user_id == user.id
|
||||
if user.role.value in ("admin", "project_manager"):
|
||||
if user.role.value in PM_ROLES:
|
||||
broadcast = AuditLog.target_user_id.is_(None)
|
||||
return and_(AuditLog.notification == True, or_(targeted, broadcast)) # noqa: E712
|
||||
return and_(AuditLog.notification == True, targeted) # noqa: E712
|
||||
|
||||
Reference in New Issue
Block a user