Remove unused UIFeature.BulkUnverifiedSessionsReminder setting (#31943)
This commit is contained in:
@@ -581,8 +581,6 @@ Currently, the following UI feature flags are supported:
|
|||||||
This should only be used if the room history visibility options are managed by the server.
|
This should only be used if the room history visibility options are managed by the server.
|
||||||
- `UIFeature.TimelineEnableRelativeDates` - Display relative date separators (eg: 'Today', 'Yesterday') in the
|
- `UIFeature.TimelineEnableRelativeDates` - Display relative date separators (eg: 'Today', 'Yesterday') in the
|
||||||
timeline for recent messages. When false day dates will be used.
|
timeline for recent messages. When false day dates will be used.
|
||||||
- `UIFeature.BulkUnverifiedSessionsReminder` - Display popup reminders to verify or remove unverified sessions. Defaults
|
|
||||||
to true.
|
|
||||||
- `UIFeature.locationSharing` - Whether or not location sharing menus will be shown.
|
- `UIFeature.locationSharing` - Whether or not location sharing menus will be shown.
|
||||||
- `UIFeature.allowCreatingPublicRooms` - Whether or not public rooms can be created.
|
- `UIFeature.allowCreatingPublicRooms` - Whether or not public rooms can be created.
|
||||||
- `UIFeature.allowCreatingPublicSpaces` - Whether or not public spaces can be created.
|
- `UIFeature.allowCreatingPublicSpaces` - Whether or not public spaces can be created.
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import SdkConfig from "./SdkConfig";
|
|||||||
import PlatformPeg from "./PlatformPeg";
|
import PlatformPeg from "./PlatformPeg";
|
||||||
import { recordClientInformation, removeClientInformation } from "./utils/device/clientInformation";
|
import { recordClientInformation, removeClientInformation } from "./utils/device/clientInformation";
|
||||||
import SettingsStore, { type CallbackFn } from "./settings/SettingsStore";
|
import SettingsStore, { type CallbackFn } from "./settings/SettingsStore";
|
||||||
import { UIFeature } from "./settings/UIFeature";
|
|
||||||
import { isBulkUnverifiedDeviceReminderSnoozed } from "./utils/device/snoozeBulkUnverifiedDeviceReminder";
|
import { isBulkUnverifiedDeviceReminderSnoozed } from "./utils/device/snoozeBulkUnverifiedDeviceReminder";
|
||||||
import { getUserDeviceIds } from "./utils/crypto/deviceInfo";
|
import { getUserDeviceIds } from "./utils/crypto/deviceInfo";
|
||||||
import { asyncSomeParallel } from "./utils/arrays.ts";
|
import { asyncSomeParallel } from "./utils/arrays.ts";
|
||||||
@@ -125,7 +124,6 @@ export default class DeviceListener extends TypedEventEmitter<DeviceListenerEven
|
|||||||
// The client with which the instance is running. Only set if `running` is true, otherwise undefined.
|
// The client with which the instance is running. Only set if `running` is true, otherwise undefined.
|
||||||
private client?: MatrixClient;
|
private client?: MatrixClient;
|
||||||
private shouldRecordClientInformation = false;
|
private shouldRecordClientInformation = false;
|
||||||
private enableBulkUnverifiedSessionsReminder = true;
|
|
||||||
private deviceClientInformationSettingWatcherRef: string | undefined;
|
private deviceClientInformationSettingWatcherRef: string | undefined;
|
||||||
private deviceState: DeviceState = "ok";
|
private deviceState: DeviceState = "ok";
|
||||||
|
|
||||||
@@ -151,7 +149,6 @@ export default class DeviceListener extends TypedEventEmitter<DeviceListenerEven
|
|||||||
this.client.on(ClientEvent.ToDeviceEvent, this.onToDeviceEvent);
|
this.client.on(ClientEvent.ToDeviceEvent, this.onToDeviceEvent);
|
||||||
this.shouldRecordClientInformation = SettingsStore.getValue("deviceClientInformationOptIn");
|
this.shouldRecordClientInformation = SettingsStore.getValue("deviceClientInformationOptIn");
|
||||||
// only configurable in config, so we don't need to watch the value
|
// only configurable in config, so we don't need to watch the value
|
||||||
this.enableBulkUnverifiedSessionsReminder = SettingsStore.getValue(UIFeature.BulkUnverifiedSessionsReminder);
|
|
||||||
this.deviceClientInformationSettingWatcherRef = SettingsStore.watchSetting(
|
this.deviceClientInformationSettingWatcherRef = SettingsStore.watchSetting(
|
||||||
"deviceClientInformationOptIn",
|
"deviceClientInformationOptIn",
|
||||||
null,
|
null,
|
||||||
@@ -587,12 +584,7 @@ export default class DeviceListener extends TypedEventEmitter<DeviceListenerEven
|
|||||||
|
|
||||||
// Display or hide the batch toast for old unverified sessions
|
// Display or hide the batch toast for old unverified sessions
|
||||||
// don't show the toast if the current device is unverified
|
// don't show the toast if the current device is unverified
|
||||||
if (
|
if (oldUnverifiedDeviceIds.size > 0 && isCurrentDeviceTrusted && !isBulkUnverifiedSessionsReminderSnoozed) {
|
||||||
oldUnverifiedDeviceIds.size > 0 &&
|
|
||||||
isCurrentDeviceTrusted &&
|
|
||||||
this.enableBulkUnverifiedSessionsReminder &&
|
|
||||||
!isBulkUnverifiedSessionsReminderSnoozed
|
|
||||||
) {
|
|
||||||
showBulkUnverifiedSessionsToast(oldUnverifiedDeviceIds);
|
showBulkUnverifiedSessionsToast(oldUnverifiedDeviceIds);
|
||||||
} else {
|
} else {
|
||||||
hideBulkUnverifiedSessionsToast();
|
hideBulkUnverifiedSessionsToast();
|
||||||
|
|||||||
@@ -1437,10 +1437,6 @@ export const SETTINGS: Settings = {
|
|||||||
supportedLevels: LEVELS_UI_FEATURE,
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
[UIFeature.BulkUnverifiedSessionsReminder]: {
|
|
||||||
supportedLevels: LEVELS_UI_FEATURE,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
[UIFeature.AllowCreatingPublicSpaces]: {
|
[UIFeature.AllowCreatingPublicSpaces]: {
|
||||||
supportedLevels: LEVELS_UI_FEATURE,
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
default: true,
|
default: true,
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ export const enum UIFeature {
|
|||||||
AdvancedSettings = "UIFeature.advancedSettings",
|
AdvancedSettings = "UIFeature.advancedSettings",
|
||||||
RoomHistorySettings = "UIFeature.roomHistorySettings",
|
RoomHistorySettings = "UIFeature.roomHistorySettings",
|
||||||
TimelineEnableRelativeDates = "UIFeature.timelineEnableRelativeDates",
|
TimelineEnableRelativeDates = "UIFeature.timelineEnableRelativeDates",
|
||||||
BulkUnverifiedSessionsReminder = "UIFeature.BulkUnverifiedSessionsReminder",
|
|
||||||
AllowCreatingPublicRooms = "UIFeature.allowCreatingPublicRooms",
|
AllowCreatingPublicRooms = "UIFeature.allowCreatingPublicRooms",
|
||||||
AllowCreatingPublicSpaces = "UIFeature.allowCreatingPublicSpaces",
|
AllowCreatingPublicSpaces = "UIFeature.allowCreatingPublicSpaces",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import { Action } from "../../src/dispatcher/actions";
|
|||||||
import SettingsStore from "../../src/settings/SettingsStore";
|
import SettingsStore from "../../src/settings/SettingsStore";
|
||||||
import { SettingLevel } from "../../src/settings/SettingLevel";
|
import { SettingLevel } from "../../src/settings/SettingLevel";
|
||||||
import { getMockClientWithEventEmitter, mockPlatformPeg } from "../test-utils";
|
import { getMockClientWithEventEmitter, mockPlatformPeg } from "../test-utils";
|
||||||
import { UIFeature } from "../../src/settings/UIFeature";
|
|
||||||
import { isBulkUnverifiedDeviceReminderSnoozed } from "../../src/utils/device/snoozeBulkUnverifiedDeviceReminder";
|
import { isBulkUnverifiedDeviceReminderSnoozed } from "../../src/utils/device/snoozeBulkUnverifiedDeviceReminder";
|
||||||
import { PosthogAnalytics } from "../../src/PosthogAnalytics";
|
import { PosthogAnalytics } from "../../src/PosthogAnalytics";
|
||||||
|
|
||||||
@@ -653,10 +652,8 @@ describe("DeviceListener", () => {
|
|||||||
// all devices verified by default
|
// all devices verified by default
|
||||||
mockCrypto!.getDeviceVerificationStatus.mockResolvedValue(deviceTrustVerified);
|
mockCrypto!.getDeviceVerificationStatus.mockResolvedValue(deviceTrustVerified);
|
||||||
mockClient!.deviceId = currentDevice.deviceId;
|
mockClient!.deviceId = currentDevice.deviceId;
|
||||||
jest.spyOn(SettingsStore, "getValue").mockImplementation(
|
|
||||||
(settingName) => settingName === UIFeature.BulkUnverifiedSessionsReminder,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("bulk unverified sessions toasts", () => {
|
describe("bulk unverified sessions toasts", () => {
|
||||||
it("hides toast when cross signing is not ready", async () => {
|
it("hides toast when cross signing is not ready", async () => {
|
||||||
mockCrypto!.isCrossSigningReady.mockResolvedValue(false);
|
mockCrypto!.isCrossSigningReady.mockResolvedValue(false);
|
||||||
@@ -671,24 +668,6 @@ describe("DeviceListener", () => {
|
|||||||
expect(BulkUnverifiedSessionsToast.showToast).not.toHaveBeenCalled();
|
expect(BulkUnverifiedSessionsToast.showToast).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("hides toast when feature is disabled", async () => {
|
|
||||||
// BulkUnverifiedSessionsReminder set to false
|
|
||||||
jest.spyOn(SettingsStore, "getValue").mockReturnValue(false);
|
|
||||||
// currentDevice, device2 are verified, device3 is unverified
|
|
||||||
// ie if reminder was enabled it should be shown
|
|
||||||
mockCrypto!.getDeviceVerificationStatus.mockImplementation(async (_userId, deviceId) => {
|
|
||||||
switch (deviceId) {
|
|
||||||
case currentDevice.deviceId:
|
|
||||||
case device2.deviceId:
|
|
||||||
return deviceTrustVerified;
|
|
||||||
default:
|
|
||||||
return deviceTrustUnverified;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await createAndStart();
|
|
||||||
expect(BulkUnverifiedSessionsToast.hideToast).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("hides toast when current device is unverified", async () => {
|
it("hides toast when current device is unverified", async () => {
|
||||||
// device2 verified, current and device3 unverified
|
// device2 verified, current and device3 unverified
|
||||||
mockCrypto!.getDeviceVerificationStatus.mockImplementation(async (_userId, deviceId) => {
|
mockCrypto!.getDeviceVerificationStatus.mockImplementation(async (_userId, deviceId) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user