fix frontend
This commit is contained in:
@@ -33,7 +33,7 @@ from app.services.audit_service import get_real_ip
|
||||
from app.services.search_service import SearchService
|
||||
|
||||
from app.config import get_settings
|
||||
from app.core.exceptions import ForbiddenError, NotFoundError
|
||||
from app.core.exceptions import ConflictError, ForbiddenError, NotFoundError
|
||||
from app.database import get_db
|
||||
from app.dependencies import CurrentUser, DB
|
||||
from app.models.label import Label
|
||||
@@ -446,11 +446,15 @@ async def bulk_update_messages(
|
||||
elif not data.is_trashed:
|
||||
message.trashed_at = None
|
||||
if data.is_pending_conservation is not None:
|
||||
message.is_pending_conservation = data.is_pending_conservation
|
||||
if data.is_pending_conservation and not message.pending_conservation_at:
|
||||
message.pending_conservation_at = now
|
||||
elif not data.is_pending_conservation:
|
||||
message.pending_conservation_at = None
|
||||
# Guard bulk: non rimandare in conservazione messaggi gia' conservati
|
||||
if data.is_pending_conservation and message.is_conserved:
|
||||
pass # skip — gia' conservato, non viene ri-accodato
|
||||
else:
|
||||
message.is_pending_conservation = data.is_pending_conservation
|
||||
if data.is_pending_conservation and not message.pending_conservation_at:
|
||||
message.pending_conservation_at = now
|
||||
elif not data.is_pending_conservation:
|
||||
message.pending_conservation_at = None
|
||||
if data.is_conserved is not None:
|
||||
message.is_conserved = data.is_conserved
|
||||
if data.is_conserved and not message.conserved_at:
|
||||
@@ -551,6 +555,12 @@ async def update_message(
|
||||
perm_svc = PermissionService(db)
|
||||
await perm_svc.require_can_conserve(current_user, message.mailbox_id)
|
||||
|
||||
# Guard: blocca re-accodamento di messaggi gia' conservati
|
||||
if data.is_pending_conservation is True and message.is_conserved:
|
||||
raise ConflictError(
|
||||
"Questo messaggio e' gia' stato conservato e non puo' essere rimandato in conservazione."
|
||||
)
|
||||
|
||||
now = datetime.now(timezone.utc)
|
||||
ip = get_real_ip(request)
|
||||
ua = request.headers.get("user-agent")
|
||||
|
||||
Reference in New Issue
Block a user