diff --git a/app/views/CreateDiscussionView/index.js b/app/views/CreateDiscussionView/index.js
index 5a19dc5e..46b2d6cd 100644
--- a/app/views/CreateDiscussionView/index.js
+++ b/app/views/CreateDiscussionView/index.js
@@ -116,10 +116,14 @@ class CreateChannelView extends React.Component {
} = this.state;
const { create } = this.props;
- // create discussion
- create({
- prid: prid || rid, pmid, t_name, reply, users, encrypted
- });
+ const params = {
+ prid: prid || rid, pmid, t_name, reply, users
+ };
+ if (this.isEncryptionEnabled) {
+ params.encrypted = encrypted ?? false;
+ }
+
+ create(params);
};
valid = () => {
@@ -145,6 +149,12 @@ class CreateChannelView extends React.Component {
this.setState({ users: value });
}
+ get isEncryptionEnabled() {
+ const { channel } = this.state;
+ const { encryptionEnabled } = this.props;
+ return encryptionEnabled && E2E_ROOM_TYPES[channel?.t];
+ }
+
onEncryptedChange = (value) => {
logEvent(events.CD_TOGGLE_ENCRY);
this.setState({ encrypted: value });
@@ -152,10 +162,10 @@ class CreateChannelView extends React.Component {
render() {
const {
- name, users, encrypted, channel
+ name, users, encrypted
} = this.state;
const {
- server, user, loading, blockUnauthenticatedAccess, theme, serverVersion, encryptionEnabled
+ server, user, loading, blockUnauthenticatedAccess, theme, serverVersion
} = this.props;
return (
- {encryptionEnabled && E2E_ROOM_TYPES[channel?.t]
+ {this.isEncryptionEnabled
? (
<>
{I18n.t('Encrypted')}