FIX: Use base 10 when gettings allowed group IDs from settings. (#113)

A missing parameter on the `parseInt` function was causing unexpected UI behavior for the AI helper since it turned an allowed group ID into NaN. We should always use base10 when parsing these IDs.
This commit is contained in:
Roman Rizzi 2023-07-24 11:29:49 -03:00 committed by GitHub
parent 3f05d3a732
commit 79289ba231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -149,7 +149,7 @@ export default {
const aiBotsAllowedGroups = settings.ai_bot_allowed_groups const aiBotsAllowedGroups = settings.ai_bot_allowed_groups
.split("|") .split("|")
.map(parseInt); .map((id) => parseInt(id, 10));
const canInteractWithAIBots = user?.groups.some((g) => const canInteractWithAIBots = user?.groups.some((g) =>
aiBotsAllowedGroups.includes(g.id) aiBotsAllowedGroups.includes(g.id)
); );

View File

@ -60,7 +60,7 @@ export default {
const allowedGroups = settings.ai_helper_allowed_groups const allowedGroups = settings.ai_helper_allowed_groups
.split("|") .split("|")
.map(parseInt); .map((id) => parseInt(id, 10));
const canUseAssistant = user?.groups.some((g) => const canUseAssistant = user?.groups.some((g) =>
allowedGroups.includes(g.id) allowedGroups.includes(g.id)
); );