Fix template selection for posts with images but empty content_type

- Added detection for posts with images when content_type is empty
- Posts with images now correctly show as polaroid style instead of news

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-01-21 01:53:39 +00:00
parent dd5954caad
commit da4fde9185
2 changed files with 10 additions and 2 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "sociowire-frontend",
"version": "0.0.64",
"version": "0.0.95",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sociowire-frontend",
"version": "0.0.64",
"version": "0.0.95",
"dependencies": {
"@fortawesome/fontawesome-free": "^7.1.0",
"axios": "^1.13.2",

View File

@ -310,6 +310,14 @@ export function getTemplateKeyForPost(post) {
return 'camera';
}
// If content_type is empty/unknown but post has images, show as polaroid
// This handles posts where content_type wasn't set but images exist
const hasImage = !!(post?.image_small || post?.image_medium || post?.image_large || post?.image || post?.thumbnail_url || post?.media_url);
const hasVideo = !!(post?.video_url || post?.embed_url);
if (!ct && hasImage && !hasVideo) {
return 'polaroid';
}
// Default: category-based template
return normCat(post);
}