1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-05 23:10:41 +03:00

Associate created rooms with the selected community

This commit is contained in:
Travis Ralston
2020-08-26 10:53:06 -06:00
parent fd71bca7c0
commit c28134eb11
3 changed files with 19 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ import * as Rooms from "./Rooms";
import DMRoomMap from "./utils/DMRoomMap";
import {getAddressType} from "./UserAddress";
import { getE2EEWellKnown } from "./utils/WellKnownUtils";
import GroupStore from "./stores/GroupStore";
// we define a number of interfaces which take their names from the js-sdk
/* eslint-disable camelcase */
@@ -79,6 +80,7 @@ interface IOpts {
encryption?: boolean;
inlineErrors?: boolean;
andView?: boolean;
associatedWithCommunity?: string;
}
/**
@@ -181,6 +183,10 @@ export default function createRoom(opts: IOpts): Promise<string | null> {
} else {
return Promise.resolve();
}
}).then(() => {
if (opts.associatedWithCommunity) {
return GroupStore.addRoomToGroup(opts.associatedWithCommunity, roomId, false);
}
}).then(function() {
// NB createRoom doesn't block on the client seeing the echo that the
// room has been created, so we race here with the client knowing that