From f289c94c0af45b8aab27584104498217dd3f4196 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 9 Jan 2026 01:44:32 -0700 Subject: [PATCH 1/2] Add the includeRequestor option and deprecate includeGM in the notify socket --- module/sockets/query/notify.mjs | 10 ++++++++-- module/utils/QueryManager.mjs | 13 +++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/module/sockets/query/notify.mjs b/module/sockets/query/notify.mjs index 624e7b2..42758f6 100644 --- a/module/sockets/query/notify.mjs +++ b/module/sockets/query/notify.mjs @@ -1,8 +1,8 @@ import { localizer } from "../../utils/localizer.mjs"; import { respondedToQueries } from "../../utils/QueryManager.mjs"; -export function queryNotify(payload) { - const { id, userID, content, includeGM } = payload; +export function queryNotify(payload, sender) { + const { id, userID, content, includeGM, includeRequestor } = payload; if (userID !== game.user.id) { return }; @@ -10,10 +10,16 @@ export function queryNotify(payload) { if (!respondedToQueries.has(id)) { return }; let whisper = [game.user.id]; + + // TODO: remove this code with #19 if (includeGM) { whisper = game.users.filter(u => u.isGM).map(u => u.id); }; + if (includeRequestor) { + whisper = [sender.id]; + }; + ChatMessage.implementation.create({ flavor: localizer(`taf.misc.data-query-notif-header`), content, diff --git a/module/utils/QueryManager.mjs b/module/utils/QueryManager.mjs index 5d6d8ae..c6b3744 100644 --- a/module/utils/QueryManager.mjs +++ b/module/utils/QueryManager.mjs @@ -229,17 +229,26 @@ async function maybeResolve(requestID) { }; }; -export async function notify(requestID, userID, content, { includeGM = false } = {}) { +export async function notify(requestID, userID, content, { includeGM = false, includeRequestor } = {}) { // Prevent sending notifications for not-your queries if (!queries.has(requestID)) { return }; + // TODO: remove this code with #19 + if (includeGM) { + foundry.utils.logCompatibilityWarning( + `The "includeGM" option has been deprecated in favour of "includeRequestor"`, + { since: `v2.4.0`, until: `v3.0.0` }, + ); + }; + game.socket.emit(`system.taf`, { event: `query.notify`, payload: { id: requestID, userID, content, - includeGM, + includeGM, // TODO: remove this code with #19 + includeRequestor, }, }); }; From 9aa67bab0242e64a1e5cee5600cbf1434fc72d75 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 9 Jan 2026 21:23:08 -0700 Subject: [PATCH 2/2] Update the simple helper to use the new option instead of the deprecated one --- module/utils/QueryManager.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/utils/QueryManager.mjs b/module/utils/QueryManager.mjs index c6b3744..9b84937 100644 --- a/module/utils/QueryManager.mjs +++ b/module/utils/QueryManager.mjs @@ -43,7 +43,7 @@ async function sendBasicNotification(requestID, userID, answers) { { answers }, ); - await notify(requestID, userID, content, { includeGM: false }); + await notify(requestID, userID, content, { includeRequestor: false }); }; export function has(requestID) {