When creating private spaces, make the initial rooms restricted if supported
This commit is contained in:
parent
855c3819c1
commit
030fa17a66
1 changed files with 4 additions and 2 deletions
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
import React, { RefObject, useContext, useRef, useState } from "react";
|
import React, { RefObject, useContext, useRef, useState } from "react";
|
||||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||||
import { Preset, JoinRule } from "matrix-js-sdk/src/@types/partials";
|
import { JoinRule, Preset } from "matrix-js-sdk/src/@types/partials";
|
||||||
import { Room } from "matrix-js-sdk/src/models/room";
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
import { EventSubscription } from "fbemitter";
|
import { EventSubscription } from "fbemitter";
|
||||||
|
|
||||||
|
@ -505,11 +505,12 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
|
||||||
setError("");
|
setError("");
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
try {
|
try {
|
||||||
|
const isPublic = space.getJoinRule() === JoinRule.Public;
|
||||||
const filteredRoomNames = roomNames.map(name => name.trim()).filter(Boolean);
|
const filteredRoomNames = roomNames.map(name => name.trim()).filter(Boolean);
|
||||||
await Promise.all(filteredRoomNames.map(name => {
|
await Promise.all(filteredRoomNames.map(name => {
|
||||||
return createRoom({
|
return createRoom({
|
||||||
createOpts: {
|
createOpts: {
|
||||||
preset: space.getJoinRule() === "public" ? Preset.PublicChat : Preset.PrivateChat,
|
preset: isPublic ? Preset.PublicChat : Preset.PrivateChat,
|
||||||
name,
|
name,
|
||||||
},
|
},
|
||||||
spinner: false,
|
spinner: false,
|
||||||
|
@ -517,6 +518,7 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
|
||||||
andView: false,
|
andView: false,
|
||||||
inlineErrors: true,
|
inlineErrors: true,
|
||||||
parentSpace: space,
|
parentSpace: space,
|
||||||
|
joinRule: !isPublic ? JoinRule.Restricted : undefined,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
onFinished(filteredRoomNames.length > 0);
|
onFinished(filteredRoomNames.length > 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue