feat: Enhance reported photos handling with detailed confirmation dialogs
This commit improves the user experience in the ReportedPhotos component by adding specific confirmation dialogs for photo removal decisions. It ensures users are aware of the consequences of their actions, particularly when permanently deleting photos. Additionally, the backend has been updated to handle deletion of tag linkages associated with photos, ensuring data integrity. Documentation has been updated to reflect these changes.
This commit is contained in:
@@ -11,7 +11,7 @@ from sqlalchemy import text
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from src.web.db.session import get_auth_db, get_db
|
||||
from src.web.db.models import Photo
|
||||
from src.web.db.models import Photo, PhotoTagLinkage
|
||||
from src.web.api.users import get_current_admin_user
|
||||
|
||||
router = APIRouter(prefix="/reported-photos", tags=["reported-photos"])
|
||||
@@ -224,14 +224,19 @@ def review_reported_photos(
|
||||
kept_count += 1 # Count as kept since we couldn't remove it
|
||||
continue
|
||||
|
||||
# Delete the photo (cascade will delete faces, tags, etc.)
|
||||
# Delete tag linkages for this photo
|
||||
main_db.query(PhotoTagLinkage).filter(
|
||||
PhotoTagLinkage.photo_id == photo.id
|
||||
).delete(synchronize_session=False)
|
||||
|
||||
# Delete the photo (cascade will delete faces, etc.)
|
||||
main_db.delete(photo)
|
||||
main_db.commit()
|
||||
|
||||
# Update status in auth database
|
||||
# Update status in auth database to dismissed
|
||||
auth_db.execute(text("""
|
||||
UPDATE inappropriate_photo_reports
|
||||
SET status = 'reviewed',
|
||||
SET status = 'dismissed',
|
||||
reviewed_at = :reviewed_at,
|
||||
reviewed_by = :reviewed_by,
|
||||
review_notes = :review_notes
|
||||
|
||||
Reference in New Issue
Block a user