bulltrackers-module 1.0.681 → 1.0.683
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -184,18 +184,24 @@ const fetchPopularInvestorMasterList = async (firestore, userId = null) => {
|
|
|
184
184
|
// 4. Fetch developer overrides data
|
|
185
185
|
// GOAL : Used for allowing a given userID to have special abilities
|
|
186
186
|
// Any userID document given in path /dev_overrides/ like /dev_overrides/29312236, is considered a developer, we want to return a true bool if a given ID is a developer, otherwise return false
|
|
187
|
+
// [FIX] Must check that enabled === true, not just document existence
|
|
187
188
|
|
|
188
189
|
const isDeveloper = async (firestore, userId) => {
|
|
189
190
|
try {
|
|
190
191
|
const docRef = firestore.collection('dev_overrides').doc(userId);
|
|
191
|
-
|
|
192
192
|
const docSnapshot = await docRef.get();
|
|
193
|
-
|
|
193
|
+
|
|
194
|
+
// Check both that document exists AND enabled === true
|
|
195
|
+
if (!docSnapshot.exists) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const data = docSnapshot.data();
|
|
200
|
+
return data?.enabled === true;
|
|
194
201
|
}
|
|
195
202
|
catch (error) {
|
|
196
203
|
console.error(`Error checking developer status: ${error}`);
|
|
197
204
|
throw error;
|
|
198
|
-
|
|
199
205
|
}
|
|
200
206
|
};
|
|
201
207
|
|
|
@@ -34,7 +34,7 @@ const PUBLIC_ROUTES = [
|
|
|
34
34
|
'/popular-investors/search',
|
|
35
35
|
'/popular-investors/profile', // Public PI profiles - userCid optional for personalization
|
|
36
36
|
'/verification/lookup', // Uses Firebase Auth token instead of userCid
|
|
37
|
-
|
|
37
|
+
// NOTE: /alerts/types REMOVED - now requires auth to check developer status for test alerts
|
|
38
38
|
'/alerts/dynamic-watchlist-computations', // Static data - doesn't need userCid
|
|
39
39
|
'/popular-investors/track-view', // Optional userCid - can track views anonymously
|
|
40
40
|
'/reviews' // Public reviews - userCid optional (for showing current user's review)
|
|
@@ -47,11 +47,15 @@ router.get('/types', async (req, res, next) => {
|
|
|
47
47
|
// Check if user is a developer
|
|
48
48
|
const isDev = await isDeveloper(db, String(req.targetUserId));
|
|
49
49
|
|
|
50
|
+
logger?.log('INFO', `[GET /alerts/types] User ${req.targetUserId} isDeveloper: ${isDev}, loaded ${alertTypes.length} total alert types`);
|
|
51
|
+
|
|
50
52
|
// Filter out test alerts for non-developers
|
|
51
53
|
const filteredAlertTypes = isDev
|
|
52
54
|
? alertTypes
|
|
53
55
|
: alertTypes.filter(type => !type.isTest);
|
|
54
56
|
|
|
57
|
+
logger?.log('INFO', `[GET /alerts/types] After filtering: ${filteredAlertTypes.length} alert types (removed ${alertTypes.length - filteredAlertTypes.length} test alerts)`);
|
|
58
|
+
|
|
55
59
|
// Format response for frontend
|
|
56
60
|
const formattedTypes = filteredAlertTypes.map(type => ({
|
|
57
61
|
id: type.id,
|