mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 05:05:53 +00:00
Handle offline integrations better
This commit is contained in:
parent
5aca4fde93
commit
77d652d6c0
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user