From ec4db294f9614b4e0e3b10111e71c7e7d6b3abfa Mon Sep 17 00:00:00 2001 From: Julien DAUPHANT Date: Tue, 5 Sep 2023 14:34:45 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"Cr=C3=A9er=20les=20salons=20dans=20un?= =?UTF-8?q?=20espace"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b33c60c2e8fcb5e4e0bc58f3a6c02c4c8edccf86. --- .../views/dialogs/TchapCreateRoomDialog.tsx | 9 ++--- .../views/elements/TchapRoomTypeSelector.tsx | 7 ++-- src/tchap/lib/createTchapRoom.ts | 34 +++---------------- 3 files changed, 10 insertions(+), 40 deletions(-) diff --git a/src/tchap/components/views/dialogs/TchapCreateRoomDialog.tsx b/src/tchap/components/views/dialogs/TchapCreateRoomDialog.tsx index 4a845da0b4..ac5184f0dd 100644 --- a/src/tchap/components/views/dialogs/TchapCreateRoomDialog.tsx +++ b/src/tchap/components/views/dialogs/TchapCreateRoomDialog.tsx @@ -32,7 +32,7 @@ import TchapCreateRoom from "../../../lib/createTchapRoom"; interface IProps { defaultPublic?: boolean; // unused for Tchap version defaultName?: string; - parentSpace?: Room; + parentSpace?: Room; // unused for Tchap version defaultEncrypted?: boolean; // unused for Tchap version onFinished(proceed: boolean, opts?: IOpts): void; } @@ -43,16 +43,13 @@ interface IState { tchapRoomType: TchapRoomType; forumFederationSwitchValue: boolean; showFederateSwitch: boolean; - createRoomInSpace: boolean; } export default class TchapCreateRoomDialog extends React.Component { private nameField = createRef(); - private readonly createRoomInSpace: boolean; public constructor(props) { super(props); - this.createRoomInSpace = !!this.props.parentSpace; const federationOptions = TchapUtils.getRoomFederationOptions(); @@ -62,7 +59,6 @@ export default class TchapCreateRoomDialog extends React.Component diff --git a/src/tchap/components/views/elements/TchapRoomTypeSelector.tsx b/src/tchap/components/views/elements/TchapRoomTypeSelector.tsx index 9e0c00a0fb..5f23cc05e7 100644 --- a/src/tchap/components/views/elements/TchapRoomTypeSelector.tsx +++ b/src/tchap/components/views/elements/TchapRoomTypeSelector.tsx @@ -21,7 +21,6 @@ interface IProps { forumFederationSwitchValue?: boolean; setRoomType(value: TchapRoomType): void; setForumFederationSwitchValue(forumFederationSwitchValue: boolean): void; - createRoomInSpace: boolean; } interface IState { @@ -84,7 +83,7 @@ export default class TchapRoomTypeSelector extends React.Component
{_t("Private room")}
-
{this.createRoomInSpace ? _t("Private discussions accessible to all users of this space.") : _t("Accessible to all users by invitation from an administrator.")}
+
{_t("Accessible to all users by invitation from an administrator.")}
@@ -110,7 +109,7 @@ export default class TchapRoomTypeSelector extends React.Component
{_t("Forum room")}
-
{this.createRoomInSpace ? _t("Public discussion accessible to all users of this space or from a shared link.") : _t("Accessible to all users from the forum directory or from a shared link.")}
+
{_t("Accessible to all users from the forum directory or from a shared link.")}
{roomFederateOpt} diff --git a/src/tchap/lib/createTchapRoom.ts b/src/tchap/lib/createTchapRoom.ts index 1e79c9a92c..e5680fcd1c 100644 --- a/src/tchap/lib/createTchapRoom.ts +++ b/src/tchap/lib/createTchapRoom.ts @@ -30,16 +30,10 @@ export default class TchapCreateRoom { createRoomOpts.creation_content = { "m.federate": federate }; createRoomOpts.initial_state = createRoomOpts.initial_state || []; - opts.parentSpace = this.props.parentSpace; - switch (tchapRoomType) { case TchapRoomType.Forum: { - // Space "Forum" only for members and not encrypted - if (this.props.parentSpace) { - createRoomOpts.visibility = Visibility.PrivateChat; - } else { //"Forum" only for tchap members and not encrypted - createRoomOpts.visibility = Visibility.Public; - } + //"Forum" only for tchap members and not encrypted + createRoomOpts.visibility = Visibility.Public; createRoomOpts.preset = Preset.PublicChat; // Here we could have used createRoomOpts.accessRule directly, // but since accessRules are a custom Tchap event, it is ignored by later code. @@ -52,12 +46,7 @@ export default class TchapCreateRoom { state_key: "", }); - //Open to space by default - if (this.props.parentSpace) { - opts.joinRule = JoinRule.Restricted; - } else { - opts.joinRule = JoinRule.Public; - } + opts.joinRule = JoinRule.Public; opts.encryption = false; opts.historyVisibility = HistoryVisibility.Shared; break; @@ -73,12 +62,7 @@ export default class TchapCreateRoom { type: TchapRoomAccessRulesEventId, state_key: "", }); - //Open to space by default - if (this.props.parentSpace) { - opts.joinRule = JoinRule.Restricted; - } else { - opts.joinRule = JoinRule.Invite; - } + opts.joinRule = JoinRule.Invite; opts.encryption = true; opts.historyVisibility = HistoryVisibility.Invited; break; @@ -94,20 +78,12 @@ export default class TchapCreateRoom { type: TchapRoomAccessRulesEventId, state_key: "", }); - //Open to space by default - if (this.props.parentSpace) { - opts.joinRule = JoinRule.Restricted; - } else { - opts.joinRule = JoinRule.Invite; - } + opts.joinRule = JoinRule.Invite; opts.encryption = true; opts.historyVisibility = HistoryVisibility.Invited; break; } } - - - return opts; } }