fix: remove console.log statements from gallery and auth pages
Mirror to GitHub / mirror (push) Successful in 23s
Test and Lint / backend-test (push) Successful in 1m35s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m29s
Version and Release / version-bump (push) Failing after 52s
Version and Release / trigger-drone (push) Has been skipped

- Remove debug logging from GalleryView component
- Remove console.error statements from auth contexts
- Clean up image loading error logs
- Replace console statements with comments for production security

No sensitive information is now logged to console in production.
This commit is contained in:
2025-07-17 09:31:21 +02:00
parent 4e214588a7
commit 027c1090a4
10 changed files with 16 additions and 46 deletions
@@ -54,16 +54,7 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
// Fetch photos
const { data, isLoading, error, refetch } = useGalleryPhotos(slug);
// Debug logging
useEffect(() => {
console.log('Event prop:', event);
console.log('Event prop hero_photo_id:', event?.hero_photo_id);
if (data) {
console.log('Gallery data:', data);
console.log('Event data from API:', data.event);
console.log('Hero photo ID from API:', data.event?.hero_photo_id);
}
}, [data, event]);
// Data updates are handled by React Query
const downloadAllMutation = useDownloadAllPhotos();
// Handle window resize
@@ -124,7 +115,7 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
}
}
} catch (e) {
console.error('Failed to parse event theme:', e);
// Invalid theme format - use default
// Fall back to global theme
if (settingsData.theme_config) {
themeToApply = settingsData.theme_config;
@@ -142,10 +133,10 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
// If there's a hero photo, add it to gallery settings
if (fullEvent.hero_photo_id && themeToApply.gallerySettings) {
themeToApply.gallerySettings.heroImageId = fullEvent.hero_photo_id;
console.log('Setting hero photo ID in existing gallery settings:', fullEvent.hero_photo_id);
// Apply hero photo ID to existing gallery settings
} else if (fullEvent.hero_photo_id) {
themeToApply.gallerySettings = { heroImageId: fullEvent.hero_photo_id };
console.log('Creating gallery settings with hero photo ID:', fullEvent.hero_photo_id);
// Create gallery settings with hero photo ID
}
setTheme(themeToApply);
}, 0);
@@ -368,11 +359,6 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
headerExtra={(() => {
const items = [];
console.log('Header extra - data loaded:', !!data);
console.log('Header extra - allow uploads:', data?.event?.allow_user_uploads);
console.log('Header extra - showSidebar:', showSidebar);
console.log('Header extra - isMobile:', isMobile);
if (daysUntilExpiration <= 1 && daysUntilExpiration > 0) {
items.push(
<CountdownTimer key="countdown" expiresAt={event.expires_at} className="mr-2" />
@@ -92,7 +92,7 @@ export const PhotoGrid: React.FC<PhotoGridProps> = ({ photos, slug, categoryId }
const downloadPromises = selectedPhotosList.map(photo =>
galleryService.downloadPhoto(slug, photo.id, photo.filename)
.catch(err => {
console.error(`Failed to download ${photo.filename}:`, err);
// Download failed - error handled by UI
return null;
})
);
@@ -115,7 +115,7 @@ export const PhotoGridWithLayouts: React.FC<PhotoGridWithLayoutsProps> = ({
const downloadPromises = selectedPhotosList.map(photo =>
galleryService.downloadPhoto(slug, photo.id, photo.filename)
.catch(err => {
console.error(`Failed to download ${photo.filename}:`, err);
// Download failed - error handled by UI
return null;
})
);
@@ -79,7 +79,7 @@ export const UserPhotoUpload: React.FC<UserPhotoUploadProps> = ({
});
successCount++;
} catch (error: any) {
console.error(`Failed to upload ${file.name}:`, error);
// Upload error handled - user notified via UI
failedCount++;
// Show specific error message
@@ -47,12 +47,12 @@ export const HeroGalleryLayout: React.FC<HeroGalleryLayoutProps> = ({
useEffect(() => {
if (photos.length > 0) {
const heroId = gallerySettings.heroImageId;
console.log('HeroGalleryLayout - heroImageId:', heroId, 'photos:', photos.length);
// Process hero layout with provided photos
// If admin has selected a specific hero image, always use it
if (heroId) {
const adminSelectedHero = photos.find(p => p.id === heroId);
console.log('Looking for hero photo with ID:', heroId, 'Found:', adminSelectedHero?.filename);
// Hero photo selected by admin
if (adminSelectedHero) {
setHeroPhoto(adminSelectedHero);
setHasInitialized(true);