Handle offline integrations better

This commit is contained in:
Travis Ralston 2019-04-14 16:39:44 -06:00
parent 5aca4fde93
commit 77d652d6c0
3 changed files with 3 additions and 17 deletions

View File

@ -11,7 +11,6 @@ import { ComplexBot } from "../../integrations/ComplexBot";
import { Bridge } from "../../integrations/Bridge";
import { BridgeStore } from "../../db/BridgeStore";
import { BotStore } from "../../db/BotStore";
import { AdminService } from "../admin/AdminService";
export interface IntegrationsResponse {
widgets: Widget[],
@ -66,11 +65,6 @@ export class DimensionIntegrationsService {
.map(b => SimpleBot.fromCached(b));
const bots = [...nebs, ...custom];
Cache.for(CACHE_INTEGRATIONS).put("simple_bots", bots);
if (!AdminService.isAdmin(userId)) {
return bots.filter(b => b.isOnline);
}
return bots;
}
@ -86,11 +80,6 @@ export class DimensionIntegrationsService {
const bots = await NebStore.listComplexBots(userId, roomId);
Cache.for(CACHE_INTEGRATIONS).put("complex_bots_" + roomId, bots);
if (!AdminService.isAdmin(userId)) {
return bots.filter(b => b.isOnline);
}
return bots;
}

View File

@ -12,7 +12,6 @@ import { TelegramBridge } from "../bridges/TelegramBridge";
import { WebhooksBridge } from "../bridges/WebhooksBridge";
import { GitterBridge } from "../bridges/GitterBridge";
import { SlackBridge } from "../bridges/SlackBridge";
import { AdminService } from "../api/admin/AdminService";
export class BridgeStore {
@ -47,10 +46,6 @@ export class BridgeStore {
}
}
if (!AdminService.isAdmin(requestingUserId)) {
return enabledBridges.filter(b => b.isOnline);
}
return enabledBridges;
}

View File

@ -149,7 +149,9 @@ export class NebStore {
const notifUserId = await proxy.getNotificationUserId(i.integration, roomId);
const botUserId = null; // TODO: For github
const botConfig = await proxy.getServiceConfiguration(i.integration, roomId);
return new ComplexBot(i.integration, notifUserId, botUserId, botConfig);
const bot = new ComplexBot(i.integration, notifUserId, botUserId, botConfig);
bot.isOnline = !!bot.botUserId;
return bot;
} catch (e) {
LogService.error("NebStore", e);