Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deactivate setup xsss toast, activate xsss ff in production #455

Merged
merged 3 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"feature_thread": true,
"feature_video_rooms" : false,
"feature_new_device_manager" : false,
"tchap_activate_cross_signing_and_secure_storage" : true
"tchap_activate_cross_signing_and_secure_storage" : true,
"tchap_disable_cross_signing_setup_toast": true
},
"default_federate": true,
"default_theme": "light",
Expand Down
3 changes: 2 additions & 1 deletion config.preprod.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"feature_thread": true,
"feature_video_rooms" : false,
"feature_new_device_manager" : false,
"tchap_activate_cross_signing_and_secure_storage" : true
"tchap_activate_cross_signing_and_secure_storage" : true,
"tchap_disable_cross_signing_setup_toast": true
},
"default_federate": true,
"default_theme": "light",
Expand Down
3 changes: 2 additions & 1 deletion config.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
"feature_thread": true,
"feature_video_rooms" : false,
"feature_new_device_manager" : false,
"tchap_activate_cross_signing_and_secure_storage" : false
"tchap_activate_cross_signing_and_secure_storage" : true,
"tchap_disable_cross_signing_setup_toast": true
},
"default_federate": true,
"default_theme": "light",
Expand Down
29 changes: 27 additions & 2 deletions patches/cross-signing-ui/matrix-react-sdk+3.63.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,18 @@ index 8da8e5c..746ab0a 100644
aria-label={_t("Skip verification for now")}
/>
diff --git a/node_modules/matrix-react-sdk/src/toasts/SetupEncryptionToast.ts b/node_modules/matrix-react-sdk/src/toasts/SetupEncryptionToast.ts
index 5dc32de..c087058 100644
index 5dc32de..f5cb1cd 100644
--- a/node_modules/matrix-react-sdk/src/toasts/SetupEncryptionToast.ts
+++ b/node_modules/matrix-react-sdk/src/toasts/SetupEncryptionToast.ts
@@ -50,7 +50,9 @@ const getIcon = (kind: Kind) => {
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

+import TchapUIFeature from "../../../../src/util/TchapUIFeature";
import Modal from "../Modal";
import { _t } from "../languageHandler";
import DeviceListener from "../DeviceListener";
@@ -50,7 +51,9 @@ const getIcon = (kind: Kind) => {
const getSetupCaption = (kind: Kind) => {
switch (kind) {
case Kind.SET_UP_ENCRYPTION:
Expand All @@ -152,3 +160,20 @@ index 5dc32de..c087058 100644
case Kind.UPGRADE_ENCRYPTION:
return _t("Upgrade");
case Kind.VERIFY_THIS_SESSION:
@@ -79,6 +82,16 @@ const onReject = () => {
};

export const showToast = (kind: Kind) => {
+ /* :TCHAP: hide cross-signing setup toast when feature flag tchap_disable_cross_signing_setup_toast is on */
+ if (
+ TchapUIFeature.isCrossSigningAndSecureStorageActive()
+ && TchapUIFeature.isCrossSigningSetupToastDisabled()
+ && (kind === Kind.SET_UP_ENCRYPTION || kind === Kind.UPGRADE_ENCRYPTION)
+ ) {
+ return;
+ }
+ /* end :TCHAP: */
+
if (SecurityCustomisations.setupEncryptionNeeded?.(kind)) {
return;
}
12 changes: 12 additions & 0 deletions src/util/TchapUIFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ export default class TchapUIFeature {
return isCrossSigningAndSecureStorageActive;
};

/**
* This flag activates cross-signing and secure storage. But it also hides the xsss setup toast.
* needs to be initialized to access the config.json (where the flag is set)
*/
public static isCrossSigningSetupToastDisabled = () : Boolean => {
//retrieve the feature flag from the config.json features flag section.
//beware SdkConfig does not like to be invoked before the MatrixClient is initialized
const isCrossSigningSetupToastDisabled = SdkConfig.get("features")['tchap_disable_cross_signing_setup_toast'];
console.log(":tchap: tchap_disable_cross_signing_setup_toast from config.json: ", isCrossSigningSetupToastDisabled);
return isCrossSigningSetupToastDisabled;
};

/**
* This flag controls whether to force incoming key legacy verification (usefull for older mobile device than android 2.6, ios 2.2.3)
*/
Expand Down