Skip to content
Snippets Groups Projects
Unverified Commit 9975a8b2 authored by Marcos Spessatto Defendi's avatar Marcos Spessatto Defendi Committed by GitHub
Browse files

Regression: Remove alpha tag and fix initialization process (#26248)

parent 023cc31d
No related branches found
No related tags found
No related merge requests found
......@@ -28,9 +28,12 @@ export const federationRoomServiceSender = FederationFactory.buildRoomServiceSen
);
FederationFactory.setupListeners(federationRoomServiceSender);
rocketSettingsAdapter.onFederationEnabledStatusChanged(federation.onFederationAvailabilityChanged.bind(federation));
let cancelSettingsObserver: Function;
export const runFederation = async (): Promise<void> => {
cancelSettingsObserver = rocketSettingsAdapter.onFederationEnabledStatusChanged(
federation.onFederationAvailabilityChanged.bind(federation),
);
if (!rocketSettingsAdapter.isFederationEnabled()) {
return;
}
......@@ -42,6 +45,7 @@ export const runFederation = async (): Promise<void> => {
export const stopFederation = async (): Promise<void> => {
FederationFactory.removeListeners();
await federation.stop();
cancelSettingsObserver();
};
(async (): Promise<void> => {
......
......@@ -57,8 +57,8 @@ export class RocketChatSettingsAdapter {
return settings.get('Federation_Matrix_enabled') === true;
}
public onFederationEnabledStatusChanged(callback: Function): void {
settings.watchMultiple(
public onFederationEnabledStatusChanged(callback: Function): Function {
return settings.watchMultiple(
[
'Federation_Matrix_enabled',
'Federation_Matrix_id',
......
......@@ -33,8 +33,13 @@ const runFederationEE = async (): Promise<void> => {
await federationEE.start();
};
let cancelSettingsObserverEE: Function;
onToggledFeature('federation', {
up: async () => {
cancelSettingsObserverEE = rocketSettingsAdapter.onFederationEnabledStatusChanged(
federationEE.onFederationAvailabilityChanged.bind(federationEE),
);
if (!rocketSettingsAdapter.isFederationEnabled()) {
return;
}
......@@ -48,5 +53,6 @@ onToggledFeature('federation', {
await federationEE.stop();
await runFederation();
FederationFactoryEE.removeListeners();
cancelSettingsObserverEE();
},
});
......@@ -2030,7 +2030,7 @@
"FEDERATION_Unique_Id_Description": "This is your federation unique ID, used to identify your peer on the mesh.",
"Federation_Matrix": "Federation V2",
"Federation_Matrix_enabled": "Enabled",
"Federation_Matrix_Enabled_Alert": "Matrix Federation Support is in alpha. Use on a production system is not recommended at this time. <a target=\"_blank\" href=\"https://go.rocket.chat/i/matrix-federation\">More Information about Matrix Federation support can be found here</> (After any configuration, a restart is required to the changes take effect)",
"Federation_Matrix_Enabled_Alert": "<a target=\"_blank\" href=\"https://go.rocket.chat/i/matrix-federation\">More Information about Matrix Federation support can be found here</> (After any configuration, a restart is required to the changes take effect)",
"Federation_Matrix_Federated": "Federated",
"Federation_Matrix_Federated_Description": "By creating a federated room you'll not be able to enable encryption nor broadcast",
"Federation_Matrix_Federated_Description_disabled": "This feature is currently disabled in this workspace.",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment