Refactor: Database and UI updates

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 21:32:04 +00:00
parent 63d9d8890c
commit 22f4a68bd8
9 changed files with 349 additions and 34 deletions

View File

@@ -118,13 +118,15 @@ serve(async (req) => {
reportedEntityName = profile?.display_name || profile?.username || 'User Profile';
} else if (payload.reportedEntityType === 'content_submission') {
const { data: submission } = await supabase
.from('content_submissions')
.select('content')
.eq('id', payload.reportedEntityId)
// Query submission_metadata table for the name instead of dropped content JSONB column
const { data: metadata } = await supabase
.from('submission_metadata')
.select('metadata_value')
.eq('submission_id', payload.reportedEntityId)
.eq('metadata_key', 'name')
.maybeSingle();
reportedEntityName = submission?.content?.name || 'Submission';
reportedEntityName = metadata?.metadata_value || 'Submission';
}
} catch (error) {
edgeLogger.warn('Could not fetch entity name', { action: 'notify_moderators_report', requestId: tracking.requestId, error });