mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 17:31:12 -05:00
Fix photo submission entity information
This commit is contained in:
@@ -503,21 +503,21 @@ export const ModerationQueue = forwardRef<ModerationQueueRef>((props, ref) => {
|
|||||||
// Handle photo submissions - create photos records when approved
|
// Handle photo submissions - create photos records when approved
|
||||||
if (action === 'approved' && item.type === 'content_submission' && item.submission_type === 'photo') {
|
if (action === 'approved' && item.type === 'content_submission' && item.submission_type === 'photo') {
|
||||||
console.log('🖼️ [PHOTO APPROVAL] Starting photo submission approval');
|
console.log('🖼️ [PHOTO APPROVAL] Starting photo submission approval');
|
||||||
console.log('🖼️ [PHOTO APPROVAL] Full item content:', JSON.stringify(item.content, null, 2));
|
console.log('🖼️ [PHOTO APPROVAL] Raw item:', item);
|
||||||
|
console.log('🖼️ [PHOTO APPROVAL] Item content type:', typeof item.content);
|
||||||
|
console.log('🖼️ [PHOTO APPROVAL] Item content keys:', Object.keys(item.content || {}));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Extract photos array - handle both nested paths
|
// Photo submissions have a simple structure: content contains { context, entity_id, photos }
|
||||||
const photosArray = item.content?.photos || item.content?.content?.photos;
|
const content = item.content;
|
||||||
const entityId = item.content?.entity_id || item.content?.park_id || item.content?.ride_id || item.content?.company_id;
|
const photosArray = content.photos;
|
||||||
const entityType = item.content?.context || item.content?.entity_type ||
|
const entityId = content.entity_id;
|
||||||
(item.content?.park_id ? 'park' :
|
const entityType = content.context;
|
||||||
item.content?.ride_id ? 'ride' :
|
|
||||||
item.content?.company_id ? 'company' : null);
|
|
||||||
|
|
||||||
console.log('🖼️ [PHOTO APPROVAL] Extracted data:', {
|
console.log('🖼️ [PHOTO APPROVAL] Extracted data:', {
|
||||||
photosArray: photosArray,
|
photosArray,
|
||||||
entityId: entityId,
|
entityId,
|
||||||
entityType: entityType,
|
entityType,
|
||||||
hasPhotosArray: !!photosArray,
|
hasPhotosArray: !!photosArray,
|
||||||
photosCount: photosArray?.length
|
photosCount: photosArray?.length
|
||||||
});
|
});
|
||||||
@@ -528,7 +528,12 @@ export const ModerationQueue = forwardRef<ModerationQueueRef>((props, ref) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!entityId || !entityType) {
|
if (!entityId || !entityType) {
|
||||||
console.error('🖼️ [PHOTO APPROVAL] ERROR: Invalid entity information', { entityId, entityType });
|
console.error('🖼️ [PHOTO APPROVAL] ERROR: Invalid entity information', {
|
||||||
|
entityId,
|
||||||
|
entityType,
|
||||||
|
contentKeys: Object.keys(content),
|
||||||
|
fullContent: content
|
||||||
|
});
|
||||||
throw new Error('Invalid entity information in photo submission');
|
throw new Error('Invalid entity information in photo submission');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user