Fix rooms claiming they are bridged when they aren't

This commit is contained in:
Travis Ralston 2018-10-19 19:34:11 -06:00
parent a0467c46e2
commit 5f0e9fec51
2 changed files with 6 additions and 13 deletions

View File

@ -29,20 +29,13 @@ export class DimensionTelegramService {
try { try {
const telegram = new TelegramBridge(userId); const telegram = new TelegramBridge(userId);
const conf = await telegram.getChatConfiguration(chatId, roomId); const conf = await telegram.getChatConfiguration(chatId, roomId);
if (!conf) return {
bridged: false,
canUnbridge: true,
chatId: chatId,
roomId: null,
chatName: null,
};
return { return {
bridged: true, bridged: conf ? conf.bridged : false,
canUnbridge: conf.canUnbridge, canUnbridge: conf ? conf.canUnbridge : false,
chatId: chatId, chatId: conf ? conf.chatId : null,
roomId: conf.roomId, roomId: conf ? conf.roomId : null,
chatName: conf.chatName, chatName: conf ? conf.chatName : null,
}; };
} catch (e) { } catch (e) {
if (e.errcode) { if (e.errcode) {

View File

@ -124,7 +124,7 @@ export class TelegramBridge {
try { try {
const info = await this.doProvisionRequest<PortalInformationResponse>(bridge, "GET", `/portal/${chatId}`, {room_id: roomId}); const info = await this.doProvisionRequest<PortalInformationResponse>(bridge, "GET", `/portal/${chatId}`, {room_id: roomId});
return { return {
bridged: !!info, bridged: info && !!info.mxid,
chatId: chatId, chatId: chatId,
roomId: info ? info.mxid : null, roomId: info ? info.mxid : null,
chatName: info ? info.title || info.username : null, chatName: info ? info.title || info.username : null,