fix: resolve multiple issues from GitHub issue #14
Mirror to GitHub / mirror (push) Successful in 46s
Test and Lint / backend-test (push) Successful in 1m54s
Test and Lint / frontend-test (push) Successful in 2m9s
Version and Release / version-bump (push) Successful in 1m5s
Version and Release / trigger-drone (push) Successful in 3s

- Fixed duplicate German translation for 'downloadSelected' button
- Added client_max_body_size configuration in nginx for file uploads
- Fixed date parsing in FeedbackModerationPanel to handle timestamps
- Fixed admin authentication context (req.admin vs req.user) in feedback routes
- Enhanced clipboard functionality with fallback for non-HTTPS contexts
- Fixed authentication token handling for numeric event IDs in uploads

These changes ensure comment moderation works properly, file uploads are configured correctly, and the UI handles all edge cases properly.

Fixes #14

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-01 22:56:44 +02:00
parent 828d6bc456
commit e91209f7cb
6 changed files with 64 additions and 11 deletions
+4 -4
View File
@@ -60,8 +60,8 @@ router.put('/events/:eventId/feedback-settings',
settings: updatedSettings
}, eventId, {
type: 'admin',
id: req.user.id,
name: req.user.username
id: req.admin.id,
name: req.admin.username
});
res.json(updatedSettings);
@@ -167,7 +167,7 @@ router.put('/feedback/:feedbackId/:action',
return res.status(400).json({ error: 'Invalid action' });
}
await feedbackService.moderateFeedback(feedbackId, action, req.user.id);
await feedbackService.moderateFeedback(feedbackId, action, req.admin.id);
res.json({ success: true });
} catch (error) {
@@ -184,7 +184,7 @@ router.delete('/feedback/:feedbackId',
try {
const { feedbackId } = req.params;
await feedbackService.deleteFeedback(feedbackId, req.user.id);
await feedbackService.deleteFeedback(feedbackId, req.admin.id);
res.json({ success: true });
} catch (error) {
+8
View File
@@ -4,6 +4,10 @@ server {
root /usr/share/nginx/html;
index index.html;
# Allow larger file uploads (up to 100MB)
client_max_body_size 100M;
client_body_timeout 300s;
# Gzip compression
gzip on;
gzip_vary on;
@@ -49,6 +53,10 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 86400;
# Allow larger uploads for API endpoints
client_max_body_size 100M;
client_body_timeout 300s;
}
# Photo serving proxy
@@ -118,7 +118,12 @@ export const FeedbackModerationPanel: React.FC<FeedbackModerationPanelProps> = (
</span>
<span className="text-neutral-500"></span>
<span className="text-neutral-500">
{format(parseISO(item.created_at), 'MMM d, h:mm a')}
{format(
typeof item.created_at === 'string'
? parseISO(item.created_at)
: new Date(item.created_at),
'MMM d, h:mm a'
)}
</span>
</div>
<p className="mt-1 text-sm text-neutral-700">{item.comment}</p>
+18 -3
View File
@@ -48,10 +48,25 @@ api.interceptors.request.use(
const galleryMatch = config.url?.match(/gallery\/([^\/]+)/);
if (galleryMatch && galleryMatch[1]) {
const gallerySlug = galleryMatch[1];
const galleryIdOrSlug = galleryMatch[1];
// Remove any query parameters from the slug
const cleanSlug = gallerySlug.split('?')[0];
const token = localStorage.getItem(`gallery_token_${cleanSlug}`);
const cleanIdOrSlug = galleryIdOrSlug.split('?')[0];
// Check if it's a numeric ID (for upload endpoints)
let token = null;
if (/^\d+$/.test(cleanIdOrSlug)) {
// It's an event ID - try to find the token from current page slug
const pathParts = window.location.pathname.split('/');
if (pathParts[1] === 'gallery' && pathParts[2]) {
const gallerySlug = pathParts[2];
const cleanSlug = gallerySlug.split('?')[0];
token = localStorage.getItem(`gallery_token_${cleanSlug}`);
}
} else {
// It's a slug - use it directly
token = localStorage.getItem(`gallery_token_${cleanIdOrSlug}`);
}
if (token) {
if (!config.headers) {
config.headers = {};
-1
View File
@@ -134,7 +134,6 @@
"sortByName": "Nach Name sortieren",
"sortBySize": "Nach Größe sortieren",
"allPhotos": "Alle Fotos",
"downloadSelected": "Ausgewählte herunterladen",
"shareGallery": "Galerie teilen",
"needHelp": "Hilfe benötigt? Kontaktieren Sie uns unter",
"noPhotosFound": "Keine Fotos gefunden",
+28 -2
View File
@@ -279,12 +279,38 @@ export const EventDetailsPage: React.FC = () => {
const handleCopyLink = async () => {
try {
await navigator.clipboard.writeText(event.share_link);
// Check if share_link exists
if (!event.share_link) {
toast.error(t('errors.noShareLink', 'No share link available'));
return;
}
// Try modern clipboard API first
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(event.share_link);
} else {
// Fallback for non-HTTPS contexts or older browsers
const textArea = document.createElement('textarea');
textArea.value = event.share_link;
textArea.style.position = 'fixed';
textArea.style.left = '-999999px';
textArea.style.top = '-999999px';
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
const successful = document.execCommand('copy');
document.body.removeChild(textArea);
if (!successful) {
throw new Error('Copy failed');
}
}
setCopiedLink(true);
setTimeout(() => setCopiedLink(false), 2000);
toast.success(t('toast.linkCopied'));
} catch (err) {
toast.error(t('errors.somethingWentWrong'));
console.error('Copy failed:', err);
toast.error(t('errors.copyFailed', 'Failed to copy link. Please copy manually.'));
}
};