IO-3166-Global-Notifications-Part-2: checkpoint

This commit is contained in:
Dave Richer
2025-03-11 11:38:56 -04:00
parent 9061821347
commit 8d36ad3589
3 changed files with 31 additions and 9 deletions

View File

@@ -37,10 +37,11 @@ const scenarioParser = async (req, jobIdField) => {
// Step 1: Validate we know what user committed the action that fired the parser
// console.log("Step 1");
const hasuraUserRole = event?.session_variables?.["x-hasura-role"];
const hasuraUserId = event?.session_variables?.["x-hasura-user-id"];
// Bail if we don't know who started the scenario
if (!hasuraUserId) {
if (hasuraUserRole === "user" && !hasuraUserId) {
logger.log("No Hasura user ID found, skipping notification parsing", "info", "notifications");
return;
}
@@ -84,7 +85,7 @@ const scenarioParser = async (req, jobIdField) => {
authId: watcher?.user?.authid
}));
if (FILTER_SELF_FROM_WATCHERS) {
if (FILTER_SELF_FROM_WATCHERS && hasuraUserRole === "user") {
jobWatchers = jobWatchers.filter((watcher) => watcher.authId !== hasuraUserId);
}