Add the special case for prompting all but the requesting user
This commit is contained in:
parent
723bcf8735
commit
db4f57fc90
1 changed files with 14 additions and 8 deletions
|
|
@ -20,26 +20,32 @@ export async function dataRequest(payload) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// null/undefined is a special case for "all users but me" by default
|
// null/undefined is a special case for "all users but me" by default
|
||||||
if (!Array.isArray(users) || users != null) {
|
if (users != null && !Array.isArray(users)) {
|
||||||
ui.notifications.error(game.i18n.format(
|
ui.notifications.error(game.i18n.format(
|
||||||
`taf.notifs.error.malformed-socket-payload`,
|
`taf.notifs.error.malformed-socket-payload`,
|
||||||
{
|
{
|
||||||
event: `query.prompt`,
|
event: `query.prompt`,
|
||||||
details: ``,
|
details: `A list of users must be provided`,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!users.includes(game.user.id)) { return };
|
if (users != null && !users.includes(game.user.id)) { return };
|
||||||
|
|
||||||
request.id = id;
|
request.id = id;
|
||||||
const result = await DialogManager.ask(request, config);
|
const result = await DialogManager.ask(request, config);
|
||||||
if (result.state === `fronted`) { return };
|
if (result.state === `fronted`) {
|
||||||
if (result.state === `errored`) {
|
|
||||||
ui.notifications.error(result.error);
|
|
||||||
return;
|
return;
|
||||||
|
} else if (result.state === `errored`) {
|
||||||
|
ui.notifications.error(result.error);
|
||||||
|
} else if (result.state === `prompted`) {
|
||||||
|
game.socket.emit(`system.taf`, {
|
||||||
|
event: `query.submit`,
|
||||||
|
payload: {
|
||||||
|
id: request.id,
|
||||||
|
answers: result.answers,
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue