chore: remove release announcement labs flag (#32775)
This commit is contained in:
@@ -1554,7 +1554,6 @@
|
|||||||
"notification_settings_beta_caption": "Introducing a simpler way to change your notification settings. Customize your %(brand)s, just the way you like.",
|
"notification_settings_beta_caption": "Introducing a simpler way to change your notification settings. Customize your %(brand)s, just the way you like.",
|
||||||
"notification_settings_beta_title": "Notification Settings",
|
"notification_settings_beta_title": "Notification Settings",
|
||||||
"notifications": "Enable the notifications panel in the room header",
|
"notifications": "Enable the notifications panel in the room header",
|
||||||
"release_announcement": "Release announcement",
|
|
||||||
"render_reaction_images": "Render custom images in reactions",
|
"render_reaction_images": "Render custom images in reactions",
|
||||||
"render_reaction_images_description": "Sometimes referred to as \"custom emojis\".",
|
"render_reaction_images_description": "Sometimes referred to as \"custom emojis\".",
|
||||||
"report_to_moderators": "Report to moderators",
|
"report_to_moderators": "Report to moderators",
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ export enum LabGroup {
|
|||||||
|
|
||||||
export enum Features {
|
export enum Features {
|
||||||
NotificationSettings2 = "feature_notification_settings2",
|
NotificationSettings2 = "feature_notification_settings2",
|
||||||
ReleaseAnnouncement = "feature_release_announcement",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const labGroupNames: Record<LabGroup, TranslationKey> = {
|
export const labGroupNames: Record<LabGroup, TranslationKey> = {
|
||||||
@@ -206,7 +205,6 @@ export interface Settings {
|
|||||||
// [settingName: `feature_${string}`]: IFeature;
|
// [settingName: `feature_${string}`]: IFeature;
|
||||||
"feature_video_rooms": IFeature;
|
"feature_video_rooms": IFeature;
|
||||||
[Features.NotificationSettings2]: IFeature;
|
[Features.NotificationSettings2]: IFeature;
|
||||||
[Features.ReleaseAnnouncement]: IFeature;
|
|
||||||
"feature_msc3531_hide_messages_pending_moderation": IFeature;
|
"feature_msc3531_hide_messages_pending_moderation": IFeature;
|
||||||
"feature_report_to_moderators": IFeature;
|
"feature_report_to_moderators": IFeature;
|
||||||
"feature_latex_maths": IFeature;
|
"feature_latex_maths": IFeature;
|
||||||
@@ -1356,16 +1354,6 @@ export const SETTINGS: Settings = {
|
|||||||
// Contains room IDs
|
// Contains room IDs
|
||||||
shouldExportToRageshake: false,
|
shouldExportToRageshake: false,
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* Enable or disable the release announcement feature
|
|
||||||
*/
|
|
||||||
[Features.ReleaseAnnouncement]: {
|
|
||||||
isFeature: true,
|
|
||||||
labsGroup: LabGroup.Ui,
|
|
||||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
|
||||||
default: true,
|
|
||||||
displayName: _td("labs|release_announcement"),
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* Managed by the {@link ReleaseAnnouncementStore}
|
* Managed by the {@link ReleaseAnnouncementStore}
|
||||||
* Store the release announcement data
|
* Store the release announcement data
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { cloneDeep } from "lodash";
|
|||||||
|
|
||||||
import SettingsStore from "../settings/SettingsStore";
|
import SettingsStore from "../settings/SettingsStore";
|
||||||
import { SettingLevel } from "../settings/SettingLevel";
|
import { SettingLevel } from "../settings/SettingLevel";
|
||||||
import { Features } from "../settings/Settings";
|
|
||||||
import ToastStore from "./ToastStore";
|
import ToastStore from "./ToastStore";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,6 +59,12 @@ export class ReleaseAnnouncementStore extends TypedEventEmitter<ReleaseAnnouncem
|
|||||||
*/
|
*/
|
||||||
private index = 0;
|
private index = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the release announcement is enabled. Useful to disable it in e2e tests.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private enabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The singleton instance of the ReleaseAnnouncementStore.
|
* The singleton instance of the ReleaseAnnouncementStore.
|
||||||
*/
|
*/
|
||||||
@@ -94,11 +99,17 @@ export class ReleaseAnnouncementStore extends TypedEventEmitter<ReleaseAnnouncem
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the release announcement is enabled.
|
* Enable the release announcement. This will allow the release announcement to be shown when calling `getReleaseAnnouncement` or `nextReleaseAnnouncement`.
|
||||||
* @private
|
|
||||||
*/
|
*/
|
||||||
private isReleaseAnnouncementEnabled(): boolean {
|
public enable(): void {
|
||||||
return SettingsStore.getValue(Features.ReleaseAnnouncement);
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the release announcement. This will prevent the release announcement from being shown when calling `getReleaseAnnouncement` or `nextReleaseAnnouncement`.
|
||||||
|
*/
|
||||||
|
public disable(): void {
|
||||||
|
this.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,8 +118,7 @@ export class ReleaseAnnouncementStore extends TypedEventEmitter<ReleaseAnnouncem
|
|||||||
*/
|
*/
|
||||||
public getReleaseAnnouncement(): Feature | null {
|
public getReleaseAnnouncement(): Feature | null {
|
||||||
// Do nothing if the release announcement is disabled
|
// Do nothing if the release announcement is disabled
|
||||||
const isReleaseAnnouncementEnabled = this.isReleaseAnnouncementEnabled();
|
if (!this.enabled) return null;
|
||||||
if (!isReleaseAnnouncementEnabled) return null;
|
|
||||||
|
|
||||||
// also don't show release announcements if any toasts are on screen
|
// also don't show release announcements if any toasts are on screen
|
||||||
if (ToastStore.sharedInstance().getToasts().length > 0) return null;
|
if (ToastStore.sharedInstance().getToasts().length > 0) return null;
|
||||||
@@ -133,9 +143,8 @@ export class ReleaseAnnouncementStore extends TypedEventEmitter<ReleaseAnnouncem
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private async markReleaseAnnouncementAsViewed(): Promise<void> {
|
private async markReleaseAnnouncementAsViewed(): Promise<void> {
|
||||||
// Do nothing if the release announcement is disabled
|
// Do nothing if the release announcement is disabled;
|
||||||
const isReleaseAnnouncementEnabled = this.isReleaseAnnouncementEnabled();
|
if (!this.enabled) return;
|
||||||
if (!isReleaseAnnouncementEnabled) return;
|
|
||||||
|
|
||||||
const viewedReleaseAnnouncements = this.getViewedReleaseAnnouncements();
|
const viewedReleaseAnnouncements = this.getViewedReleaseAnnouncements();
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ describe("ReleaseAnnouncementStore", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// Default settings
|
// Default settings
|
||||||
settings = {
|
settings = {
|
||||||
feature_release_announcement: true,
|
|
||||||
releaseAnnouncementData: {},
|
releaseAnnouncementData: {},
|
||||||
};
|
};
|
||||||
const watchCallbacks: Array<CallbackFn> = [];
|
const watchCallbacks: Array<CallbackFn> = [];
|
||||||
@@ -58,13 +57,6 @@ describe("ReleaseAnnouncementStore", () => {
|
|||||||
releaseAnnouncementStore = new ReleaseAnnouncementStore();
|
releaseAnnouncementStore = new ReleaseAnnouncementStore();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables the release announcement feature.
|
|
||||||
*/
|
|
||||||
function disableReleaseAnnouncement() {
|
|
||||||
settings["feature_release_announcement"] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listens to the next release announcement change event.
|
* Listens to the next release announcement change event.
|
||||||
*/
|
*/
|
||||||
@@ -79,8 +71,7 @@ describe("ReleaseAnnouncementStore", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should return null when the release announcement is disabled", async () => {
|
it("should return null when the release announcement is disabled", async () => {
|
||||||
disableReleaseAnnouncement();
|
releaseAnnouncementStore.disable();
|
||||||
|
|
||||||
expect(releaseAnnouncementStore.getReleaseAnnouncement()).toBeNull();
|
expect(releaseAnnouncementStore.getReleaseAnnouncement()).toBeNull();
|
||||||
|
|
||||||
// Wait for the next release announcement change event
|
// Wait for the next release announcement change event
|
||||||
|
|||||||
Reference in New Issue
Block a user