Room list: add release announcement for sections (#33800)

* feat: add release announcement for sections

* test: update screenshot

* test: update tests

* test: add release annoucement utils to close it

* test: close release announcement in custom section tests

* test: update release announcement e2e test

* test: add more tests

* feat: update Ra labels

* test: update screenshot

* chore: remove stale screenshot
This commit is contained in:
Florian Duros
2026-06-19 12:06:58 +00:00
committed by GitHub
parent 43b9bc9458
commit 338c18df16
17 changed files with 185 additions and 47 deletions
@@ -19,7 +19,7 @@ import ToastStore from "./ToastStore";
* We include a `_test_dummy` value to enable tests to function even where there are no running release announcements.
* This value must be at the end of the list.
*/
const FEATURES = ["_test_dummy1", "_test_dummy2"] as const;
const FEATURES = ["room_list_section", "_test_dummy1", "_test_dummy2"] as const;
/**
* All the features that can be shown in the release announcements.
*/
@@ -32,6 +32,7 @@ import RoomListStoreV3 from "../../stores/room-list-v3/RoomListStoreV3";
import { SortingAlgorithm } from "../../stores/room-list-v3/skip-list/sorters";
import { SettingLevel } from "../../settings/SettingLevel";
import { createRoom, hasCreateRoomRights } from "./utils";
import { ReleaseAnnouncementStore } from "../../stores/ReleaseAnnouncementStore";
export interface Props {
/**
@@ -82,6 +83,12 @@ export class RoomListHeaderViewModel
// Listen for section collapse state changes from RoomListViewModel
const dispatcherRef = defaultDispatcher.register(this.onDispatch);
this.disposables.track(() => defaultDispatcher.unregister(dispatcherRef));
this.disposables.trackListener(
ReleaseAnnouncementStore.instance,
"releaseAnnouncementChanged",
this.onReleaseAnnouncementChanged,
);
}
/**
@@ -229,7 +236,21 @@ export class RoomListHeaderViewModel
});
}
};
public closeSectionReleaseAnnouncement = (): void => {
ReleaseAnnouncementStore.instance.nextReleaseAnnouncement();
this.snapshot.merge({ displaySectionReleaseAnnouncement: false });
};
public onReleaseAnnouncementChanged = (): void => {
const isSectionFeatureEnabled = SettingsStore.getValue("feature_room_list_sections");
const displaySectionReleaseAnnouncement =
isSectionFeatureEnabled &&
ReleaseAnnouncementStore.instance.getReleaseAnnouncement() === "room_list_section";
this.snapshot.merge({ displaySectionReleaseAnnouncement });
};
}
/**
* Get the initial snapshot for the RoomListHeaderViewModel.
* @param spaceStore - The space store instance.
@@ -290,6 +311,8 @@ function computeHeaderSpaceState(
matrixClient: MatrixClient,
): Omit<RoomListHeaderViewSnapshot, "activeSortOption" | "isMessagePreviewEnabled"> {
const isSectionFeatureEnabled = SettingsStore.getValue("feature_room_list_sections");
const displaySectionReleaseAnnouncement =
isSectionFeatureEnabled && ReleaseAnnouncementStore.instance.getReleaseAnnouncement() === "room_list_section";
const activeSpace = spaceStore.activeSpaceRoom;
const title = getHeaderTitle(spaceStore);
@@ -316,5 +339,6 @@ function computeHeaderSpaceState(
canAccessSpaceSettings,
canCreateSection,
useComposeIcon,
displaySectionReleaseAnnouncement,
};
}