Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/client/configuration-resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,14 @@ async function resolveGroupByGroup(domainId, groupConfig, groupId) {
return [];
}

async function resolveSlackInstallation(args) {
async function resolveBySlackInstallation(args) {
const featureFlag = await checkSlackMultiDomain(args.slack_team_id);

if (featureFlag.result) {
if (featureFlag?.result) {
return getSlack({ team_id: args.slack_team_id, domain: args.domain });
}

const slack = await getSlack({ team_id: args.slack_team_id });
if (slack) {
args.domain = slack.domain;
}
return getSlack({ team_id: args.slack_team_id });
}

export async function resolveConfiguration(args, context) {
Expand All @@ -56,7 +53,7 @@ export async function resolveConfiguration(args, context) {
}

if (args.slack_team_id) {
await resolveSlackInstallation(args);
args.domain = (await resolveBySlackInstallation(args))?.domain;
}

if (context.domain || args.domain) {
Expand All @@ -65,7 +62,7 @@ export async function resolveConfiguration(args, context) {
if (args.key || args.config_id) {
return resolveConfigByConfig(context.domain, args.key, args.config_id);
}

return resolveGroupByGroup(context.domain, args.group, args.group_id);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/external/switcher-api-facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export async function checkMetrics(config) {

export async function checkHistory(domain) {
if (process.env.SWITCHER_API_ENABLE != 'true') {
return true;
return { result: true };
}

const { owner } = await getDomainById(domain);
Expand Down Expand Up @@ -210,7 +210,7 @@ export async function checkSlackIntegration(value) {

export async function checkSlackMultiDomain(value) {
if (process.env.SWITCHER_API_ENABLE != 'true') {
return;
return { result: true };
}

return getFeatureFlag(SwitcherKeys.SLACK_MULTI_DOMAIN)
Expand Down Expand Up @@ -255,7 +255,7 @@ export async function getRateLimit(key, component) {

export async function checkHttpsAgent(value) {
if (process.env.SWITCHER_API_ENABLE != 'true') {
return;
return { result: true };
}

return getFeatureFlag(SwitcherKeys.HTTPS_AGENT)
Expand Down