From 96805eeb9edbbdde2277d155090c955cfa664506 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Sat, 14 Jan 2023 16:10:31 +1100
Subject: Allow showing events without images

Add setting for showing such events
Fix searches not always avoiding filtered categories
---
 src/components/SearchModal.vue | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

(limited to 'src/components/SearchModal.vue')

diff --git a/src/components/SearchModal.vue b/src/components/SearchModal.vue
index 0ed2888..0673f59 100644
--- a/src/components/SearchModal.vue
+++ b/src/components/SearchModal.vue
@@ -157,11 +157,16 @@ async function resolveSearch(eventTitle: string){
 	}
 	// Check if the event data is already here
 	if (props.titleToEvent.has(eventTitle)){
-		if (visibleCtgs != null && !visibleCtgs.includes(props.titleToEvent.get(eventTitle).ctg)){
+		let event = props.titleToEvent.get(eventTitle)!;
+		if (visibleCtgs != null && !visibleCtgs.includes(event.ctg)){
 			console.log('INFO: Ignoring search for known event due to category filter');
 			return;
 		}
-		emit('search', props.titleToEvent.get(eventTitle));
+		if (store.reqImgs && event.imgId == null){
+			console.log('INFO: Ignoring search for known event due to image-only display');
+			return;
+		}
+		emit('search', event);
 		return;
 	}
 	// Query server for event
@@ -169,11 +174,14 @@ async function resolveSearch(eventTitle: string){
 	let responseObj: EventInfoJson | null = await queryServer(urlParams);
 	if (responseObj != null){
 		let eventInfo = jsonToEventInfo(responseObj);
-		// Check if event category is disabled
 		if (visibleCtgs != null && !visibleCtgs.includes(eventInfo.event.ctg)){
 			console.log('INFO: Ignoring search result due to category filter');
 			return;
 		}
+		if (store.reqImgs && eventInfo.event.imgId == null){
+			console.log('INFO: Ignoring search result due to image-only display');
+			return;
+		}
 		emit('search', eventInfo.event);
 	} else {
 		// Trigger failure animation
-- 
cgit v1.2.3

