Honour feature toggles in guest mode (#10651)

* Honour feature toggles in guest mode

* Suppress TS warning about returning null MatrixClient

* Revert "Suppress TS warning about returning null MatrixClient"

Don't ts-ignore this - we will eventually fix it via the strict work.

This reverts commit 0c657e6afd4c69d07c39bc2783184f36feaf940f.
This commit is contained in:
Andy Balaam 2023-04-24 11:02:17 +01:00 committed by GitHub
parent 8c811776bb
commit aa8c0f5cc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 87 additions and 5 deletions

View file

@ -16,7 +16,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { MatrixClientPeg } from "../../MatrixClientPeg";
import { SettingLevel } from "../SettingLevel";
import { CallbackFn, WatchManager } from "../WatchManager";
import AbstractLocalStorageSettingsHandler from "./AbstractLocalStorageSettingsHandler";
@ -117,10 +116,12 @@ export default class DeviceSettingsHandler extends AbstractLocalStorageSettingsH
// public for access to migrations - not exposed from the SettingsHandler interface
public readFeature(featureName: string): boolean | null {
if (MatrixClientPeg.get() && MatrixClientPeg.get().isGuest()) {
// Guests should not have any labs features enabled.
return false;
}
// Previously, we disabled all features for guests, but since different
// installations can have site-specific config files which might set up
// different behaviour that is relevant to guests, we removed that
// special behaviour. See
// https://github.com/vector-im/element-web/issues/24513 for the
// discussion.
// XXX: This turns they key names into `mx_labs_feature_feature_x` (double feature).
// This is because all feature names start with `feature_` as a matter of policy.