Skip to content

Commit

Permalink
Don't try to populate intents for users on other homeservers (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live authored Sep 21, 2022
1 parent 801033b commit 1d6a549
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/appservice/Appservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Metrics,
OTKAlgorithm,
redactObjectForLogging,
UserID,
} from "..";
import { MatrixBridge } from "./MatrixBridge";
import { IApplicationServiceProtocol } from "./http_responses";
Expand Down Expand Up @@ -611,6 +612,10 @@ export class Appservice extends EventEmitter {
private async processMembershipEvent(event: any): Promise<void> {
if (!event["content"]) return;

const domain = new UserID(event['state_key']).domain;
const botDomain = new UserID(this.botUserId).domain;
if (domain !== botDomain) return; // can't be impersonated, so don't try

// Update the target intent's joined rooms (fixes transition errors with the cache, like join->kick->join)
const intent = this.getIntentForUserId(event['state_key']);
await intent.refreshJoinedRooms();
Expand Down

0 comments on commit 1d6a549

Please sign in to comment.